fix: docs

This commit is contained in:
TrèsAbhi committed 2026-02-01 00:09:06 -06:00
1 parent 689985ed93
commit ba6a83a9cb
1 file changed
+10 -4
+10 -4
View File
@@ -15,11 +15,17 @@ const api = defineCollection({
for (const path in globbed) {
const id = path.replace("./pages/api/", "").replace(".ts", "");
const body = (globbed[path] as string).replaceAll("\r\n", "\n");
const docs = body.match(
/\/\*\*\n((( \*.*)\n)+) \*\/\nexport (async )?function GET\(/
)?[1].spl;
const docs = body
.match(
/\/\*\*\n((( \*.*)\n)+) \*\/\nexport (async )?function GET\(/,
)?.[1]
.split("\n")
.map((line) => line.replace(/ \* ?/, ""))
.join("\n");
paths.push({ id, body, docs: docs?.[1] ?? undefined });
if (!docs) continue;
paths.push({ id, body: docs });
}
return paths;