Skip to content

Commit 5fb4ef8

Browse files
authored
chore: provide smaller llms-small.txt (#1321)
Partially automatically summarized with manual tweaks
1 parent 7a837f7 commit 5fb4ef8

File tree

7 files changed

+1433
-39
lines changed

7 files changed

+1433
-39
lines changed
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
import { error } from '@sveltejs/kit';
2+
import svelte from '../../../../llms-small.txt/content-svelte.md?raw';
3+
import sveltekit from '../../../../llms-small.txt/content-sveltekit.md?raw';
4+
5+
export const prerender = true;
6+
7+
export function entries() {
8+
return [
9+
{ topic: 'svelte', path: '' },
10+
{ topic: 'kit', path: '' }
11+
];
12+
}
13+
14+
export function GET({ params }) {
15+
if ((params.topic !== 'svelte' && params.topic !== 'kit') || params.path) {
16+
error(404, 'Not Found');
17+
}
18+
19+
const content = params.topic === 'kit' ? sveltekit : svelte;
20+
21+
return new Response(content, {
22+
status: 200,
23+
headers: {
24+
'Content-Type': 'text/plain; charset=utf-8',
25+
'Cache-Control': 'public, max-age=3600'
26+
}
27+
});
28+
}

apps/svelte.dev/src/routes/docs/llms/+page.svelte

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,16 +20,26 @@
2020
the CLI
2121
</li>
2222
<li>
23-
<a href="/llms-small.txt">/llms-small.txt</a> — compressed documentation for use with smaller
23+
<a href="/llms-medium.txt">/llms-medium.txt</a> — compressed documentation for use with medium
2424
context windows
2525
</li>
26+
<li>
27+
<a href="/llms-small.txt">/llms-small.txt</a> — highly compressed documentation for use with
28+
smaller context windows
29+
</li>
2630
</ul>
2731

2832
<p>...and package-level documentation:</p>
2933

3034
<ul>
31-
<li><a href="/docs/svelte/llms.txt">/docs/svelte/llms.txt</a></li>
32-
<li><a href="/docs/kit/llms.txt">/docs/kit/llms.txt</a></li>
35+
<li>
36+
<a href="/docs/svelte/llms.txt">/docs/svelte/llms.txt</a> /
37+
<a href="/docs/svelte/llms-small.txt">/docs/svelte/llms-small.txt</a>
38+
</li>
39+
<li>
40+
<a href="/docs/kit/llms.txt">/docs/kit/llms.txt</a> /
41+
<a href="/docs/kit/llms-small.txt">/docs/kit/llms-small.txt</a>
42+
</li>
3343
<li><a href="/docs/cli/llms.txt">/docs/cli/llms.txt</a></li>
3444
</ul>
3545
</Text>
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
import { generate_llm_content, sections } from '$lib/server/llms';
2+
3+
export function GET() {
4+
const main_content = generate_llm_content({
5+
sections,
6+
ignore: [
7+
// Svelte ignores
8+
'docs/svelte/legacy/**/*',
9+
'docs/svelte/misc/custom-elements',
10+
'docs/svelte/misc/v4-migration-guide',
11+
'docs/svelte/misc/v5-migration-guide',
12+
'docs/svelte/misc/faq',
13+
'docs/svelte/reference/compiler-errors',
14+
'docs/svelte/reference/compiler-warnings',
15+
'docs/svelte/reference/runtime-errors',
16+
'docs/svelte/reference/runtime-warnings',
17+
'docs/svelte/reference/svelte-legacy',
18+
'**/xx-*',
19+
20+
// SvelteKit ignores
21+
'docs/kit/advanced/packaging',
22+
'docs/kit/appendix/**/*',
23+
'docs/kit/best-practices/performance',
24+
'docs/kit/build-and-deploy/*adapter-*',
25+
'docs/kit/build-and-deploy/writing-adapters'
26+
],
27+
minimize: {
28+
remove_legacy: true,
29+
remove_note_blocks: true,
30+
remove_details_blocks: true,
31+
remove_playground_links: true,
32+
remove_prettier_ignore: true,
33+
normalize_whitespace: true
34+
}
35+
});
36+
const content = `<SYSTEM>This is the abridged developer documentation for Svelte and SvelteKit.</SYSTEM>\n\n${main_content}`;
37+
38+
return new Response(content, {
39+
status: 200,
40+
headers: {
41+
'Content-Type': 'text/plain; charset=utf-8',
42+
'Cache-Control': 'public, max-age=3600'
43+
}
44+
});
45+
}
46+
47+
export const prerender = true;

apps/svelte.dev/src/routes/llms-small.txt/+server.ts

Lines changed: 5 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,10 @@
1-
import { generate_llm_content, sections } from '$lib/server/llms';
1+
import svelte from './content-svelte.md?raw';
2+
import sveltekit from './content-sveltekit.md?raw';
23

34
export function GET() {
4-
const main_content = generate_llm_content({
5-
sections,
6-
ignore: [
7-
// Svelte ignores
8-
'docs/svelte/legacy/**/*',
9-
'docs/svelte/misc/custom-elements',
10-
'docs/svelte/misc/v4-migration-guide',
11-
'docs/svelte/misc/v5-migration-guide',
12-
'docs/svelte/misc/faq',
13-
'docs/svelte/reference/compiler-errors',
14-
'docs/svelte/reference/compiler-warnings',
15-
'docs/svelte/reference/runtime-errors',
16-
'docs/svelte/reference/runtime-warnings',
17-
'docs/svelte/reference/svelte-legacy',
18-
'**/xx-*',
19-
20-
// SvelteKit ignores
21-
'docs/kit/advanced/packaging',
22-
'docs/kit/appendix/**/*',
23-
'docs/kit/best-practices/performance',
24-
'docs/kit/build-and-deploy/*adapter-*',
25-
'docs/kit/build-and-deploy/writing-adapters'
26-
],
27-
minimize: {
28-
remove_legacy: true,
29-
remove_note_blocks: true,
30-
remove_details_blocks: true,
31-
remove_playground_links: true,
32-
remove_prettier_ignore: true,
33-
normalize_whitespace: true
34-
}
35-
});
36-
const content = `<SYSTEM>This is the abridged developer documentation for Svelte and SvelteKit.</SYSTEM>\n\n${main_content}`;
5+
const content =
6+
'<SYSTEM>This is the abridged developer documentation for Svelte and SvelteKit.</SYSTEM>\n\n' +
7+
`# Svelte documentation\n\n${svelte}\n\n# SvelteKit documentation\n\n${sveltekit}`;
378

389
return new Response(content, {
3910
status: 200,

0 commit comments

Comments
 (0)