Skip to content

Commit 918b627

Browse files
committed
chore: naming
1 parent 7d89403 commit 918b627

File tree

4 files changed

+16
-16
lines changed

4 files changed

+16
-16
lines changed

apps/svelte.dev/src/lib/server/content.ts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -132,18 +132,18 @@ export const docs = create_docs();
132132

133133
export const examples = index.examples.children;
134134

135-
function getSectionPriority(path: string): number {
135+
function getDocumentationSectionPriority(path: string): number {
136136
if (path.includes('/docs/svelte/')) return 0;
137137
if (path.includes('/docs/kit/')) return 1;
138138
if (path.includes('/docs/cli/')) return 2;
139139
return 3;
140140
}
141141

142-
export function sortPaths(paths: string[]): string[] {
142+
export function sortDocumentationPaths(paths: string[]): string[] {
143143
return paths.sort((a, b) => {
144144
// First compare by section priority
145-
const priorityA = getSectionPriority(a);
146-
const priorityB = getSectionPriority(b);
145+
const priorityA = getDocumentationSectionPriority(a);
146+
const priorityB = getDocumentationSectionPriority(b);
147147
if (priorityA !== priorityB) return priorityA - priorityB;
148148

149149
// Get directory paths
@@ -274,7 +274,7 @@ function minimizeContent(content: string, options?: Partial<MinimizeOptions>): s
274274
return minimized;
275275
}
276276

277-
function shouldIncludeFile(filename: string, ignore: string[] = []): boolean {
277+
function shouldIncludeFileLlmDocs(filename: string, ignore: string[] = []): boolean {
278278
const shouldIgnore = ignore.some((pattern) => minimatch(filename, pattern));
279279
if (shouldIgnore) {
280280
if (dev) console.log(`❌ Ignored by pattern: ${filename}`);
@@ -284,16 +284,16 @@ function shouldIncludeFile(filename: string, ignore: string[] = []): boolean {
284284
return true;
285285
}
286286

287-
interface GenerateContentOptions {
287+
interface GenerateLlmContentOptions {
288288
prefix?: string;
289289
ignore?: string[];
290290
minimize?: Partial<MinimizeOptions>;
291291
package?: Package;
292292
}
293293

294-
export function generateContent(
294+
export function generateLlmContent(
295295
docs: Record<string, string>,
296-
options: GenerateContentOptions = {}
296+
options: GenerateLlmContentOptions = {}
297297
): string {
298298
const { prefix, ignore = [], minimize: minimizeOptions, package: pkg } = options;
299299

@@ -303,10 +303,10 @@ export function generateContent(
303303
}
304304

305305
let currentSection = '';
306-
const paths = sortPaths(Object.keys(docs));
306+
const paths = sortDocumentationPaths(Object.keys(docs));
307307

308308
for (const path of paths) {
309-
if (!shouldIncludeFile(path, ignore)) continue;
309+
if (!shouldIncludeFileLlmDocs(path, ignore)) continue;
310310

311311
// If a specific package is provided, only include its docs
312312
if (pkg) {

apps/svelte.dev/src/routes/docs/[...path]/llms.txt/+server.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { error } from '@sveltejs/kit';
44
import {
55
documentsContent,
66
filterDocsByPackage,
7-
generateContent,
7+
generateLlmContent,
88
getDocumentationTitle,
99
packages,
1010
type Package
@@ -30,7 +30,7 @@ export const GET: RequestHandler = async ({ params }) => {
3030
}
3131

3232
const PREFIX = `<SYSTEM>${getDocumentationTitle(packageType)}</SYSTEM>`;
33-
const content = `${PREFIX}\n\n${generateContent(filteredDocs)}`;
33+
const content = `${PREFIX}\n\n${generateLlmContent(filteredDocs)}`;
3434

3535
return new Response(content, {
3636
status: 200,

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
import type { RequestHandler } from './$types';
2-
import { documentsContent, generateContent } from '$lib/server/content';
2+
import { documentsContent, generateLlmContent } from '$lib/server/content';
33

44
const PREFIX =
55
'<SYSTEM>This is the full developer documentation for Svelte and SvelteKit.</SYSTEM>';
66

77
export const GET: RequestHandler = async () => {
8-
const content = `${PREFIX}\n\n${generateContent(documentsContent)}`;
8+
const content = `${PREFIX}\n\n${generateLlmContent(documentsContent)}`;
99

1010
return new Response(content, {
1111
status: 200,

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
import type { RequestHandler } from './$types';
2-
import { documentsContent, generateContent } from '$lib/server/content';
2+
import { documentsContent, generateLlmContent } from '$lib/server/content';
33

44
const PREFIX =
55
'<SYSTEM>This is the abridged developer documentation for Svelte and SvelteKit.</SYSTEM>';
66

77
export const GET: RequestHandler = async () => {
8-
const content = `${PREFIX}\n\n${generateContent(documentsContent, {
8+
const content = `${PREFIX}\n\n${generateLlmContent(documentsContent, {
99
ignore: [
1010
// Svelte ignores
1111
'../../../content/docs/svelte/07-misc/04-custom-elements.md',

0 commit comments

Comments
 (0)