mirror of
https://github.com/supabase/supabase.git
synced 2026-07-03 04:24:20 +08:00
* Bump all versions of postcss to 8.5.3. * Run next/codemod on the docs app. * Move two experimental flags into stable. Add next-mdx-remote as a transpiled package. * Add extra folders to the clean command in docs. * Fix type errors in docs test. * Run prettier on the new files. * remove turbopack, fix fetch revalidation, fix metadata awaits Couple of minor fixes: - Turbopack doesn't work in dev because of known MDX loader limitations (cannot load functions in MDX plugin config) - Fetches not cached by default anymore in Next 15 so need to manually cache the ones we need - Missing a few awaits for metadata generation with page params * Bump the graphiql version because headlessui/react is not building with Next 15. --------- Co-authored-by: Charis Lam <26616127+charislam@users.noreply.github.com>
57 lines
1.9 KiB
TypeScript
57 lines
1.9 KiB
TypeScript
import { notFound } from 'next/navigation'
|
|
|
|
import { REFERENCES } from '~/content/navigation.references'
|
|
import { ApiReferencePage } from '~/features/docs/Reference.apiPage'
|
|
import { CliReferencePage } from '~/features/docs/Reference.cliPage'
|
|
import { ClientSdkReferencePage } from '~/features/docs/Reference.sdkPage'
|
|
import { SelfHostingReferencePage } from '~/features/docs/Reference.selfHostingPage'
|
|
import {
|
|
generateReferenceMetadata,
|
|
generateReferenceStaticParams,
|
|
parseReferencePath,
|
|
redirectNonexistentReferenceSection,
|
|
} from '~/features/docs/Reference.utils'
|
|
|
|
export const dynamicParams = false
|
|
|
|
export default async function ReferencePage(props: { params: Promise<{ slug: Array<string> }> }) {
|
|
const params = await props.params
|
|
|
|
const { slug } = params
|
|
|
|
if (!Object.keys(REFERENCES).includes(slug[0].replaceAll('-', '_'))) {
|
|
notFound()
|
|
}
|
|
|
|
const parsedPath = parseReferencePath(slug)
|
|
const isClientSdkReference = parsedPath.__type === 'clientSdk'
|
|
const isCliReference = parsedPath.__type === 'cli'
|
|
const isApiReference = parsedPath.__type === 'api'
|
|
const isSelfHostingReference = parsedPath.__type === 'self-hosting'
|
|
|
|
if (isClientSdkReference) {
|
|
const { sdkId, maybeVersion, path } = parsedPath
|
|
|
|
const sdkData = REFERENCES[sdkId]
|
|
const latestVersion = sdkData.versions[0]
|
|
const version = maybeVersion ?? latestVersion
|
|
|
|
await redirectNonexistentReferenceSection(sdkId, version, path, version === latestVersion)
|
|
|
|
return <ClientSdkReferencePage sdkId={sdkId} libVersion={version} />
|
|
} else if (isCliReference) {
|
|
return <CliReferencePage />
|
|
} else if (isApiReference) {
|
|
return <ApiReferencePage />
|
|
} else if (isSelfHostingReference) {
|
|
return (
|
|
<SelfHostingReferencePage service={parsedPath.service} servicePath={parsedPath.servicePath} />
|
|
)
|
|
} else {
|
|
notFound()
|
|
}
|
|
}
|
|
|
|
export const generateStaticParams = generateReferenceStaticParams
|
|
export const generateMetadata = generateReferenceMetadata
|