Skip to content

Commit 190ff05

Browse files
committed
code style
1 parent c1e57a2 commit 190ff05

File tree

3 files changed

+19
-28
lines changed

3 files changed

+19
-28
lines changed
Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
import type { RequestHandler } from './$types';
2-
import type { EntryGenerator } from './$types';
31
import { error } from '@sveltejs/kit';
42
import {
53
documents_content,
@@ -11,25 +9,25 @@ import {
119

1210
export const prerender = true;
1311

14-
export const entries: EntryGenerator = () => {
12+
export function entries() {
1513
return packages.map((type) => ({ path: type }));
16-
};
14+
}
1715

18-
export const GET: RequestHandler = async ({ params }) => {
19-
const packageType = params.path;
16+
export function GET({ params }) {
17+
const package_type = params.path;
2018

21-
if (!packages.includes(packageType)) {
19+
if (!packages.includes(package_type)) {
2220
error(404, 'Not Found');
2321
}
2422

25-
const filteredDocs = filter_docs_by_package(documents_content, packageType);
23+
const filtered_docs = filter_docs_by_package(documents_content, package_type);
2624

27-
if (Object.keys(filteredDocs).length === 0) {
25+
if (Object.keys(filtered_docs).length === 0) {
2826
error(404, 'No documentation found for this package');
2927
}
3028

31-
const PREFIX = `<SYSTEM>${get_documentation_title(packageType)}</SYSTEM>`;
32-
const content = `${PREFIX}\n\n${generate_llm_content(filteredDocs)}`;
29+
const prefix = `<SYSTEM>${get_documentation_title(package_type)}</SYSTEM>`;
30+
const content = `${prefix}\n\n${generate_llm_content(filtered_docs)}`;
3331

3432
return new Response(content, {
3533
status: 200,
@@ -38,4 +36,4 @@ export const GET: RequestHandler = async ({ params }) => {
3836
'Cache-Control': 'public, max-age=3600'
3937
}
4038
});
41-
};
39+
}
Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
1-
import type { RequestHandler } from './$types';
21
import { documents_content, generate_llm_content } from '$lib/server/content';
32

4-
const PREFIX =
5-
'<SYSTEM>This is the full developer documentation for Svelte and SvelteKit.</SYSTEM>';
3+
export const prerender = true;
64

7-
export const GET: RequestHandler = async () => {
8-
const content = `${PREFIX}\n\n${generate_llm_content(documents_content)}`;
5+
export function GET() {
6+
const content = `<SYSTEM>This is the full developer documentation for Svelte and SvelteKit.</SYSTEM>\n\n${generate_llm_content(documents_content)}`;
97

108
return new Response(content, {
119
status: 200,
@@ -14,6 +12,4 @@ export const GET: RequestHandler = async () => {
1412
'Cache-Control': 'public, max-age=3600'
1513
}
1614
});
17-
};
18-
19-
export const prerender = true;
15+
}

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

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,7 @@
1-
import type { RequestHandler } from './$types';
21
import { documents_content, generate_llm_content } from '$lib/server/content';
32

4-
const PREFIX =
5-
'<SYSTEM>This is the abridged developer documentation for Svelte and SvelteKit.</SYSTEM>';
6-
7-
export const GET: RequestHandler = async () => {
8-
const content = `${PREFIX}\n\n${generate_llm_content(documents_content, {
3+
export function GET() {
4+
const main_content = generate_llm_content(documents_content, {
95
ignore: [
106
// Svelte ignores
117
'../../../content/docs/svelte/07-misc/04-custom-elements.md',
@@ -36,7 +32,8 @@ export const GET: RequestHandler = async () => {
3632
removePrettierIgnore: true,
3733
normalizeWhitespace: true
3834
}
39-
})}`;
35+
});
36+
const content = `<SYSTEM>This is the abridged developer documentation for Svelte and SvelteKit.</SYSTEM>\n\n${main_content}`;
4037

4138
return new Response(content, {
4239
status: 200,
@@ -45,6 +42,6 @@ export const GET: RequestHandler = async () => {
4542
'Cache-Control': 'public, max-age=3600'
4643
}
4744
});
48-
};
45+
}
4946

5047
export const prerender = true;

0 commit comments

Comments
 (0)