mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-26 20:19:50 +01:00
fix: optional static paths
This commit is contained in:
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) {
|
||||||
|
|||||||
Reference in new issue
Block a user