fix: optional static paths

This commit is contained in:
tresabhi committed 2025-03-20 01:00:20 -05:00
1 parent 754dff72b9
commit 30b18f60be
1 file changed
+2 -3
@@ -48,15 +48,14 @@ const globRaw = import.meta.glob('/src/pages/api/**/*.ts', {
}) as Record<string, string>; }) as Record<string, string>;
const globStaticPaths = import.meta.glob('/src/pages/api/**/*.ts', { const globStaticPaths = import.meta.glob('/src/pages/api/**/*.ts', {
eager: true, eager: true,
import: 'getStaticPaths', }) as Record<string, { getStaticPaths?: GetStaticPaths }>;
}) as Record<string, GetStaticPaths | undefined>;
let apis: APIPath[] = []; let apis: APIPath[] = [];
for (const rawPath in globRaw) { for (const rawPath in globRaw) {
const content = globRaw[rawPath].replaceAll('\r', ''); const content = globRaw[rawPath].replaceAll('\r', '');
const regexExecution = content.match(getDocsRegex); const regexExecution = content.match(getDocsRegex);
const commentRaw = regexExecution?.[1]; const commentRaw = regexExecution?.[1];
const getStaticPaths = globStaticPaths[rawPath]; const { getStaticPaths } = globStaticPaths[rawPath];
let slugs: APIPath['slugs'] | undefined; let slugs: APIPath['slugs'] | undefined;
if (getStaticPaths) { if (getStaticPaths) {