diff --git a/apps/docs/components/CustomHTMLElements/CustomHTMLElements.utils.ts b/apps/docs/components/CustomHTMLElements/CustomHTMLElements.utils.ts index eb214e4963b..0103cef6aa7 100644 --- a/apps/docs/components/CustomHTMLElements/CustomHTMLElements.utils.ts +++ b/apps/docs/components/CustomHTMLElements/CustomHTMLElements.utils.ts @@ -79,7 +79,7 @@ export const unHighlightSelectedTocItems = () => { } export const highlightSelectedNavItem = (id: string) => { - const navMenuItems = document.querySelectorAll('.function-link-item a') + const navMenuItems = document.querySelectorAll('.function-link-item a') // find any currently active items and remove them const currentActiveItems = document.querySelectorAll('.function-link-list .text-brand-900') @@ -87,7 +87,6 @@ export const highlightSelectedNavItem = (id: string) => { // Add active class to the current item navMenuItems.forEach((item) => { - // @ts-ignore if (item.href.split('/').at(-1) === id) { item.classList.add('text-brand-900') } diff --git a/apps/docs/components/Navigation/NavigationMenu/HomeMenu.tsx b/apps/docs/components/Navigation/NavigationMenu/HomeMenu.tsx index 6c18375038b..f936d122966 100644 --- a/apps/docs/components/Navigation/NavigationMenu/HomeMenu.tsx +++ b/apps/docs/components/Navigation/NavigationMenu/HomeMenu.tsx @@ -8,15 +8,13 @@ import { cn } from 'ui/src/utils/cn' import { HOMEPAGE_MENU_ITEMS } from './NavigationMenu.constants' import HomeMenuIconPicker from './HomeMenuIconPicker' -const NavigationMenuHome = ({ active }) => { +const NavigationMenuHome = () => { + const router = useRouter() + const { isDarkMode } = useTheme() + return ( -
-
- +
+ +
) }) -const SiteLayout = ({ children }) => { +const SiteLayout = ({ children }: PropsWithChildren<{}>) => { return ( <> diff --git a/apps/docs/lib/helpers.ts b/apps/docs/lib/helpers.ts index 7a6c5de3d45..112898e065a 100644 --- a/apps/docs/lib/helpers.ts +++ b/apps/docs/lib/helpers.ts @@ -1,6 +1,4 @@ -// [Joshen] I think this can be done better, as its mostly used to choose what - -import { ICommonFunc } from '../components/reference/Reference.types' +import { ICommonBase, ICommonItem, ICommonSection } from '../components/reference/Reference.types' // menus to render in the SideBar.js (Ref Nav.constants.ts) export function getPageType(asPath: string) { @@ -36,18 +34,25 @@ export function getPageType(asPath: string) { return page } -export function flattenSections(sections: ICommonFunc[]) { - let a: ICommonFunc[] = [] - for (let i = 0; i < sections.length; i++) { - if (sections[i].id) { - // only push a section that has an id - // these are reserved for sidebar subtitles - a.push(sections[i]) +/** + * Flattens common sections recursively by their `items`. + * + * _Note:_ `sections` type set to `ICommonBase[]` instead of + * `ICommonItem[]` until TypeScript supports JSON imports as const: + * https://github.com/microsoft/TypeScript/issues/32063 + */ +export function flattenSections(sections: ICommonBase[]): ICommonSection[] { + return sections.reduce((acc, section: ICommonItem) => { + // Flatten sub-items + if ('items' in section) { + let newSections = acc + + if (section.type !== 'category') { + newSections.push(section) + } + + return newSections.concat(flattenSections(section.items)) } - if (sections[i].items) { - // if there are subitems, loop through - a = a.concat(flattenSections(sections[i].items)) - } - } - return a + return acc.concat(section) + }, []) } diff --git a/apps/docs/lib/mdx/generateRefMarkdown.tsx b/apps/docs/lib/mdx/generateRefMarkdown.tsx index 1d5f7a539e9..5d959560ade 100644 --- a/apps/docs/lib/mdx/generateRefMarkdown.tsx +++ b/apps/docs/lib/mdx/generateRefMarkdown.tsx @@ -2,12 +2,9 @@ import fs from 'fs' import matter from 'gray-matter' import { serialize } from 'next-mdx-remote/serialize' +import { ICommonMarkdown } from '~/components/reference/Reference.types' -// import { remarkCodeHike } from '@code-hike/mdx' -// import codeHikeTheme from '~/codeHikeTheme.js' -// import theme from 'shiki/themes/solarized-dark.json' - -async function generateRefMarkdown(sections, slug) { +async function generateRefMarkdown(sections: ICommonMarkdown[], slug: string) { let markdownContent = [] /** * Read all the markdown files that might have @@ -16,10 +13,8 @@ async function generateRefMarkdown(sections, slug) { * - important notes regarding implementation */ await Promise.all( - sections.map(async (x, i) => { - if (!x.id) return null - - const pathName = `docs/ref${slug}/${x.id}.mdx` + sections.map(async (section) => { + const pathName = `docs/ref${slug}/${section.id}.mdx` function checkFileExists(x) { if (fs.existsSync(x)) { @@ -37,8 +32,8 @@ async function generateRefMarkdown(sections, slug) { const { data, content } = matter(fileContents) markdownContent.push({ - id: x.id, - title: x.title, + id: section.id, + title: section.title, meta: data, // introPage: introPages.includes(x), content: content diff --git a/apps/docs/lib/mdx/getConfig.tsx b/apps/docs/lib/mdx/getConfig.tsx index 4cd95686c7f..2341e23b3e2 100644 --- a/apps/docs/lib/mdx/getConfig.tsx +++ b/apps/docs/lib/mdx/getConfig.tsx @@ -1,12 +1,7 @@ -// @ts-expect-error import specStorageV0 from '~/../../spec/storage_v0_config.yaml' assert { type: 'yml' } -// @ts-expect-error import specRealtimeV0 from '~/../../spec/realtime_v0_config.yaml' assert { type: 'yml' } -// @ts-expect-error import specAuthV1 from '~/../../spec/gotrue_v1_config.yaml' assert { type: 'yml' } -// @ts-expect-error import specAnalyticsV0 from '~/../../spec/analytics_v0_config.yaml' assert { type: 'yml' } -// @ts-expect-error import specFunctionsV0 from '~/../../spec/functions_v0_config.yaml' assert { type: 'yml' } function getStorageConfigV0() { diff --git a/apps/docs/lib/mdx/handleRefStaticPaths.tsx b/apps/docs/lib/mdx/handleRefStaticPaths.tsx index c1f13e4a8c4..ae7aeb1e3b4 100644 --- a/apps/docs/lib/mdx/handleRefStaticPaths.tsx +++ b/apps/docs/lib/mdx/handleRefStaticPaths.tsx @@ -1,13 +1,14 @@ -import { getAllDocs } from '../docs' - -async function handleRefGetStaticPaths() { - let docs = getAllDocs() +import { ICommonSection } from '~/components/reference/Reference.types' +async function handleRefGetStaticPaths(sections: ICommonSection[], libraryPath: string) { return { - paths: docs.map(() => { + paths: sections.map((section) => { return { params: { - slug: docs.map((d) => d.slug), + slug: libraryPath + .split('/') + .filter((dir) => !!dir) + .concat(section.slug), }, } }), diff --git a/apps/docs/lib/mdx/handleRefStaticProps.tsx b/apps/docs/lib/mdx/handleRefStaticProps.tsx index c97245387f9..56c6c159ed0 100644 --- a/apps/docs/lib/mdx/handleRefStaticProps.tsx +++ b/apps/docs/lib/mdx/handleRefStaticProps.tsx @@ -1,7 +1,11 @@ +import { ICommonMarkdown, ICommonSection } from '~/components/reference/Reference.types' import generateRefMarkdown from '~/lib/mdx/generateRefMarkdown' -async function handleRefStaticProps(sections, librarypath) { - let markdownContent = await generateRefMarkdown(sections, librarypath) +async function handleRefStaticProps(sections: ICommonSection[], libraryPath: string) { + const markdownSections = sections.filter( + (section): section is ICommonMarkdown => section.type === 'markdown' + ) + const markdownContent = await generateRefMarkdown(markdownSections, libraryPath) return { props: { diff --git a/apps/docs/lib/refGenerator/helpers.ts b/apps/docs/lib/refGenerator/helpers.ts index 3325d45786f..d7c6ec52147 100644 --- a/apps/docs/lib/refGenerator/helpers.ts +++ b/apps/docs/lib/refGenerator/helpers.ts @@ -3,6 +3,7 @@ import { TsDoc } from '../../generator/legacy/definitions' import { values, mapValues } from 'lodash' import { OpenAPIV3 } from 'openapi-types' import { flattenSections } from '../helpers' +import { ICommonItem } from '~/components/reference/Reference.types' export function extractTsDocNode(nodeToFind: string, definition: any) { const nodePath = nodeToFind.split('.') @@ -294,12 +295,13 @@ export const toArrayWithKey = (obj: object, keyAs: string) => }) ) -export function generateAllowedClientLibKeys(sections, spec) { +/** + * Get a list of common section IDs that are available in this spec + */ +export function getAvailableSectionIds(sections: ICommonItem[], spec: any) { // Filter parent sections first - const specIds = spec.functions.map((func) => { - return func.id - }) + const specIds = spec.functions.map(({ id }) => id) const newShape = flattenSections(sections).filter((section) => { if (specIds.includes(section.id)) { diff --git a/apps/docs/next.config.mjs b/apps/docs/next.config.mjs index b3c71cae82e..5f38a0d35c6 100644 --- a/apps/docs/next.config.mjs +++ b/apps/docs/next.config.mjs @@ -6,6 +6,12 @@ import rehypeSlug from 'rehype-slug' import withTM from 'next-transpile-modules' import withYaml from 'next-plugin-yaml' +import configureBundleAnalyzer from '@next/bundle-analyzer' + +const withBundleAnalyzer = configureBundleAnalyzer({ + enabled: process.env.ANALYZE === 'true', +}) + // import admonitions from 'remark-admonitions' // import { remarkCodeHike } from '@code-hike/mdx' @@ -39,7 +45,7 @@ const withMDX = nextMdx({ }, }) -// /** @type {NextConfig} */ +/** @type {import('next').NextConfig} nextConfig */ const nextConfig = { // Append the default value with md extensions pageExtensions: ['ts', 'tsx', 'js', 'jsx', 'md', 'mdx'], @@ -58,6 +64,11 @@ const nextConfig = { }, experimental: { mdxRs: true, + modularizeImports: { + lodash: { + transform: 'lodash/{{member}}', + }, + }, }, async headers() { return [ @@ -92,9 +103,14 @@ const nextConfig = { }, } -// next.config.js -export default () => { - // const plugins = [withMDX]/ - const plugins = [withTM(['ui', 'common', '@supabase/auth-helpers-nextjs']), withMDX, withYaml] +const configExport = () => { + const plugins = [ + withTM(['ui', 'common', '@supabase/auth-helpers-nextjs']), + withMDX, + withYaml, + withBundleAnalyzer, + ] return plugins.reduce((acc, next) => next(acc), nextConfig) } + +export default configExport diff --git a/apps/docs/package.json b/apps/docs/package.json index 0eb29301d62..a4d4a7133da 100644 --- a/apps/docs/package.json +++ b/apps/docs/package.json @@ -6,6 +6,7 @@ "dev": "next dev --port 3001", "dev:secrets:pull": "AWS_PROFILE=supabase-dev node internals/getSecrets.js", "build": "npm run generate:all && next build", + "build:analyze": "ANALYZE=true next build", "start": "next start", "lint": "next lint", "build:sitemap": "node ./internals/generate-sitemap.mjs", @@ -46,6 +47,7 @@ "@docsearch/react": "^3.3.0", "@mdx-js/loader": "^1.6.22", "@mdx-js/react": "^1.6.22", + "@next/bundle-analyzer": "^13.4.0", "@next/mdx": "^12.0.4", "@octokit/auth-app": "^4.0.9", "@octokit/core": "^4.2.0", diff --git a/apps/docs/pages/_app.tsx b/apps/docs/pages/_app.tsx index f2f415a6963..abde5d72106 100644 --- a/apps/docs/pages/_app.tsx +++ b/apps/docs/pages/_app.tsx @@ -3,11 +3,8 @@ import { SessionContextProvider } from '@supabase/auth-helpers-react' import { AuthProvider, ThemeProvider, useTelemetryProps } from 'common' import { useRouter } from 'next/router' import { useEffect, useState } from 'react' -import ReactMarkdown from 'react-markdown' -import remarkGfm from 'remark-gfm' import { AppPropsWithLayout } from 'types' import { CommandMenuProvider } from 'ui' -import components from '~/components' import Favicons from '~/components/Favicons' import SiteLayout from '~/layouts/SiteLayout' import { API_URL, IS_PLATFORM, LOCAL_SUPABASE } from '~/lib/constants' diff --git a/apps/docs/pages/reference/analytics/config.tsx b/apps/docs/pages/reference/analytics/config.tsx index e22dfe2e911..ed0c0dc07a6 100644 --- a/apps/docs/pages/reference/analytics/config.tsx +++ b/apps/docs/pages/reference/analytics/config.tsx @@ -4,7 +4,6 @@ import components from '~/components/index' import { MDXRemote } from 'next-mdx-remote' import { serialize } from 'next-mdx-remote/serialize' -// @ts-expect-error import specFile from '~/../../spec/analytics_v0_config.yaml' assert { type: 'yml' } import { Parameter } from '~/lib/refGenerator/refTypes' diff --git a/apps/docs/pages/reference/api/[...slug].tsx b/apps/docs/pages/reference/api/[...slug].tsx index 382c882a190..ca4c7128256 100644 --- a/apps/docs/pages/reference/api/[...slug].tsx +++ b/apps/docs/pages/reference/api/[...slug].tsx @@ -8,17 +8,17 @@ import { gen_v3 } from '~/lib/refGenerator/helpers' // @ts-ignore const generatedSpec = gen_v3(specFile, 'wat', { apiUrl: 'apiv0' }) - const sections = flattenSections(apiCommonSections) +const libraryPath = '/api' export default function Config(props) { return } export async function getStaticProps() { - return handleRefStaticProps(sections, '/api') + return handleRefStaticProps(sections, libraryPath) } -export function getStaticPaths() { - return handleRefGetStaticPaths() +export async function getStaticPaths() { + return handleRefGetStaticPaths(sections, libraryPath) } diff --git a/apps/docs/pages/reference/auth/config.tsx b/apps/docs/pages/reference/auth/config.tsx index c024dbe9ecc..41b9437f148 100644 --- a/apps/docs/pages/reference/auth/config.tsx +++ b/apps/docs/pages/reference/auth/config.tsx @@ -1,4 +1,3 @@ -// @ts-expect-error import specFile from '~/../../spec/gotrue_v1_config.yaml' assert { type: 'yml' } import { Parameter } from '~/lib/refGenerator/refTypes' import ReactMarkdown from 'react-markdown' diff --git a/apps/docs/pages/reference/cli/[...slug].tsx b/apps/docs/pages/reference/cli/[...slug].tsx index 3555095ee72..1fe46fa04a9 100644 --- a/apps/docs/pages/reference/cli/[...slug].tsx +++ b/apps/docs/pages/reference/cli/[...slug].tsx @@ -1,4 +1,3 @@ -// @ts-expect-error import spec from '~/../../spec/cli_v1_commands.yaml' assert { type: 'yml' } import { flattenSections } from '~/lib/helpers' @@ -9,15 +8,16 @@ import handleRefGetStaticPaths from '~/lib/mdx/handleRefStaticPaths' import handleRefStaticProps from '~/lib/mdx/handleRefStaticProps' const sections = flattenSections(cliCommonSections) +const libraryPath = '/cli' export default function CliRef(props) { return } export async function getStaticProps() { - return handleRefStaticProps(sections, '/cli') + return handleRefStaticProps(sections, libraryPath) } -export function getStaticPaths() { - return handleRefGetStaticPaths() +export async function getStaticPaths() { + return handleRefGetStaticPaths(sections, libraryPath) } diff --git a/apps/docs/pages/reference/cli/config.tsx b/apps/docs/pages/reference/cli/config.tsx index a40295b3802..6a167f1ec03 100644 --- a/apps/docs/pages/reference/cli/config.tsx +++ b/apps/docs/pages/reference/cli/config.tsx @@ -1,4 +1,3 @@ -// @ts-expect-error import specFile from '~/../../spec/cli_v1_config.yaml' assert { type: 'yml' } import { Parameter } from '~/lib/refGenerator/refTypes' import ReactMarkdown from 'react-markdown' diff --git a/apps/docs/pages/reference/csharp/[...slug].tsx b/apps/docs/pages/reference/csharp/[...slug].tsx index f3e510ece23..c3ba488e1b1 100644 --- a/apps/docs/pages/reference/csharp/[...slug].tsx +++ b/apps/docs/pages/reference/csharp/[...slug].tsx @@ -1,5 +1,4 @@ import clientLibsCommonSections from '~/../../spec/common-client-libs-sections.json' -// @ts-expect-error import spec from '~/../../spec/supabase_csharp_v0.yml' assert { type: 'yml' } import RefSectionHandler from '~/components/reference/RefSectionHandler' import { flattenSections } from '~/lib/helpers' @@ -7,15 +6,16 @@ import handleRefGetStaticPaths from '~/lib/mdx/handleRefStaticPaths' import handleRefStaticProps from '~/lib/mdx/handleRefStaticProps' const sections = flattenSections(clientLibsCommonSections) +const libraryPath = '/csharp' -export default function JSReference(props) { +export default function CSharpReference(props) { return } export async function getStaticProps() { - return handleRefStaticProps(sections, '/csharp') + return handleRefStaticProps(sections, libraryPath) } -export function getStaticPaths() { - return handleRefGetStaticPaths() +export async function getStaticPaths() { + return handleRefGetStaticPaths(sections, libraryPath) } diff --git a/apps/docs/pages/reference/csharp/crawlers/[...slug].tsx b/apps/docs/pages/reference/csharp/crawlers/[...slug].tsx index 89d58eb1478..fc03fefa015 100644 --- a/apps/docs/pages/reference/csharp/crawlers/[...slug].tsx +++ b/apps/docs/pages/reference/csharp/crawlers/[...slug].tsx @@ -1,6 +1,5 @@ import clientLibsCommonSections from '~/../../spec/common-client-libs-sections.json' import typeSpec from '~/../../spec/enrichments/tsdoc_v2/combined.json' -// @ts-expect-error import spec from '~/../../spec/supabase_csharp_v0.yml' assert { type: 'yml' } import RefSectionHandler from '~/components/reference/RefSectionHandler' import { flattenSections } from '~/lib/helpers' @@ -10,8 +9,9 @@ import { useRouter } from 'next/router' import RefSEO from '~/components/reference/RefSEO' const sections = flattenSections(clientLibsCommonSections) +const libraryPath = '/csharp' -export default function JSReference(props) { +export default function CSharpReference(props) { const router = useRouter() const slug = router.query.slug[0] const filteredSection = sections.filter((section) => section.id === slug) @@ -36,9 +36,9 @@ export default function JSReference(props) { } export async function getStaticProps() { - return handleRefStaticProps(sections, '/csharp') + return handleRefStaticProps(sections, libraryPath) } -export function getStaticPaths() { - return handleRefGetStaticPaths() +export async function getStaticPaths() { + return handleRefGetStaticPaths(sections, libraryPath) } diff --git a/apps/docs/pages/reference/csharp/v0/[...slug].tsx b/apps/docs/pages/reference/csharp/v0/[...slug].tsx index 41b28c0a1ef..f8a6e985d1e 100644 --- a/apps/docs/pages/reference/csharp/v0/[...slug].tsx +++ b/apps/docs/pages/reference/csharp/v0/[...slug].tsx @@ -1,5 +1,4 @@ import clientLibsCommonSections from '~/../../spec/common-client-libs-sections.json' -// @ts-expect-error import spec from '~/../../spec/supabase_csharp_v0.yml' assert { type: 'yml' } import RefSectionHandler from '~/components/reference/RefSectionHandler' import { flattenSections } from '~/lib/helpers' @@ -7,15 +6,16 @@ import handleRefGetStaticPaths from '~/lib/mdx/handleRefStaticPaths' import handleRefStaticProps from '~/lib/mdx/handleRefStaticProps' const sections = flattenSections(clientLibsCommonSections) +const libraryPath = '/csharp/v0' -export default function JSReference(props) { +export default function CSharpReference(props) { return } export async function getStaticProps() { - return handleRefStaticProps(sections, '/csharp/v0') + return handleRefStaticProps(sections, libraryPath) } -export function getStaticPaths() { - return handleRefGetStaticPaths() +export async function getStaticPaths() { + return handleRefGetStaticPaths(sections, libraryPath) } diff --git a/apps/docs/pages/reference/csharp/v0/crawlers/[...slug].tsx b/apps/docs/pages/reference/csharp/v0/crawlers/[...slug].tsx index 059df1c75b1..18ee28ca14f 100644 --- a/apps/docs/pages/reference/csharp/v0/crawlers/[...slug].tsx +++ b/apps/docs/pages/reference/csharp/v0/crawlers/[...slug].tsx @@ -1,6 +1,5 @@ import clientLibsCommonSections from '~/../../spec/common-client-libs-sections.json' import typeSpec from '~/../../spec/enrichments/tsdoc_v2/combined.json' -// @ts-expect-error import spec from '~/../../spec/supabase_csharp_v0.yml' assert { type: 'yml' } import RefSectionHandler from '~/components/reference/RefSectionHandler' import { flattenSections } from '~/lib/helpers' @@ -10,6 +9,7 @@ import { useRouter } from 'next/router' import RefSEO from '~/components/reference/RefSEO' const sections = flattenSections(clientLibsCommonSections) +const libraryPath = '/csharp/v0' export default function JSReference(props) { const router = useRouter() @@ -35,9 +35,9 @@ export default function JSReference(props) { } export async function getStaticProps() { - return handleRefStaticProps(sections, '/csharp/v0') + return handleRefStaticProps(sections, libraryPath) } -export function getStaticPaths() { - return handleRefGetStaticPaths() +export async function getStaticPaths() { + return handleRefGetStaticPaths(sections, libraryPath) } diff --git a/apps/docs/pages/reference/dart/[...slug].tsx b/apps/docs/pages/reference/dart/[...slug].tsx index f35f74c6120..b452d04d84f 100644 --- a/apps/docs/pages/reference/dart/[...slug].tsx +++ b/apps/docs/pages/reference/dart/[...slug].tsx @@ -1,5 +1,4 @@ import clientLibsCommonSections from '~/../../spec/common-client-libs-sections.json' -// @ts-expect-error import spec from '~/../../spec/supabase_dart_v1.yml' assert { type: 'yml' } import RefSectionHandler from '~/components/reference/RefSectionHandler' import { flattenSections } from '~/lib/helpers' @@ -7,15 +6,16 @@ import handleRefGetStaticPaths from '~/lib/mdx/handleRefStaticPaths' import handleRefStaticProps from '~/lib/mdx/handleRefStaticProps' const sections = flattenSections(clientLibsCommonSections) +const libraryPath = '/dart' -export default function JSReference(props) { +export default function DartReference(props) { return } export async function getStaticProps() { - return handleRefStaticProps(sections, '/dart') + return handleRefStaticProps(sections, libraryPath) } -export function getStaticPaths() { - return handleRefGetStaticPaths() +export async function getStaticPaths() { + return handleRefGetStaticPaths(sections, libraryPath) } diff --git a/apps/docs/pages/reference/dart/crawlers/[...slug].tsx b/apps/docs/pages/reference/dart/crawlers/[...slug].tsx index 84497018cdb..29a9f880840 100644 --- a/apps/docs/pages/reference/dart/crawlers/[...slug].tsx +++ b/apps/docs/pages/reference/dart/crawlers/[...slug].tsx @@ -1,6 +1,5 @@ import clientLibsCommonSections from '~/../../spec/common-client-libs-sections.json' import typeSpec from '~/../../spec/enrichments/tsdoc_v2/combined.json' -// @ts-expect-error import spec from '~/../../spec/supabase_dart_v1.yml' assert { type: 'yml' } import RefSectionHandler from '~/components/reference/RefSectionHandler' import { flattenSections } from '~/lib/helpers' @@ -10,8 +9,9 @@ import { useRouter } from 'next/router' import RefSEO from '~/components/reference/RefSEO' const sections = flattenSections(clientLibsCommonSections) +const libraryPath = '/dart' -export default function JSReference(props) { +export default function DartReference(props) { const router = useRouter() const slug = router.query.slug[0] const filteredSection = sections.filter((section) => section.slug === slug) @@ -36,9 +36,9 @@ export default function JSReference(props) { } export async function getStaticProps() { - return handleRefStaticProps(sections, '/dart') + return handleRefStaticProps(sections, libraryPath) } -export function getStaticPaths() { - return handleRefGetStaticPaths() +export async function getStaticPaths() { + return handleRefGetStaticPaths(sections, libraryPath) } diff --git a/apps/docs/pages/reference/dart/v0/[...slug].tsx b/apps/docs/pages/reference/dart/v0/[...slug].tsx index 4b6a485d9c6..b30b791db60 100644 --- a/apps/docs/pages/reference/dart/v0/[...slug].tsx +++ b/apps/docs/pages/reference/dart/v0/[...slug].tsx @@ -1,5 +1,4 @@ import clientLibsCommonSections from '~/../../spec/common-client-libs-sections.json' -// @ts-expect-error import spec from '~/../../spec/supabase_dart_v0.yml' assert { type: 'yml' } import RefSectionHandler from '~/components/reference/RefSectionHandler' import { flattenSections } from '~/lib/helpers' @@ -7,15 +6,16 @@ import handleRefGetStaticPaths from '~/lib/mdx/handleRefStaticPaths' import handleRefStaticProps from '~/lib/mdx/handleRefStaticProps' const sections = flattenSections(clientLibsCommonSections) +const libraryPath = '/dart/v0' export default function JSReference(props) { return } export async function getStaticProps() { - return handleRefStaticProps(sections, '/dart/v0') + return handleRefStaticProps(sections, libraryPath) } -export function getStaticPaths() { - return handleRefGetStaticPaths() +export async function getStaticPaths() { + return handleRefGetStaticPaths(sections, libraryPath) } diff --git a/apps/docs/pages/reference/dart/v0/crawlers/[...slug].tsx b/apps/docs/pages/reference/dart/v0/crawlers/[...slug].tsx index 997b56deec2..1c2949b24a7 100644 --- a/apps/docs/pages/reference/dart/v0/crawlers/[...slug].tsx +++ b/apps/docs/pages/reference/dart/v0/crawlers/[...slug].tsx @@ -1,6 +1,5 @@ import clientLibsCommonSections from '~/../../spec/common-client-libs-sections.json' import typeSpec from '~/../../spec/enrichments/tsdoc_v2/combined.json' -// @ts-expect-error import spec from '~/../../spec/supabase_dart_v0.yml' assert { type: 'yml' } import RefSectionHandler from '~/components/reference/RefSectionHandler' import { flattenSections } from '~/lib/helpers' @@ -10,8 +9,9 @@ import { useRouter } from 'next/router' import RefSEO from '~/components/reference/RefSEO' const sections = flattenSections(clientLibsCommonSections) +const libraryPath = '/dart/v0' -export default function JSReference(props) { +export default function DartReference(props) { const router = useRouter() const slug = router.query.slug[0] const filteredSection = sections.filter((section) => section.slug === slug) @@ -35,9 +35,9 @@ export default function JSReference(props) { } export async function getStaticProps() { - return handleRefStaticProps(sections, '/dart/v0') + return handleRefStaticProps(sections, libraryPath) } -export function getStaticPaths() { - return handleRefGetStaticPaths() +export async function getStaticPaths() { + return handleRefGetStaticPaths(sections, libraryPath) } diff --git a/apps/docs/pages/reference/javascript/[...slug].tsx b/apps/docs/pages/reference/javascript/[...slug].tsx index 3cbbcc08694..24b8a0011ed 100644 --- a/apps/docs/pages/reference/javascript/[...slug].tsx +++ b/apps/docs/pages/reference/javascript/[...slug].tsx @@ -1,6 +1,6 @@ +import { inspect } from 'util' import clientLibsCommonSections from '~/../../spec/common-client-libs-sections.json' import typeSpec from '~/../../spec/enrichments/tsdoc_v2/combined.json' -// @ts-expect-error import spec from '~/../../spec/supabase_js_v2.yml' assert { type: 'yml' } import RefSectionHandler from '~/components/reference/RefSectionHandler' import { flattenSections } from '~/lib/helpers' @@ -8,6 +8,7 @@ import handleRefGetStaticPaths from '~/lib/mdx/handleRefStaticPaths' import handleRefStaticProps from '~/lib/mdx/handleRefStaticProps' const sections = flattenSections(clientLibsCommonSections) +const libraryPath = '/javascript' export default function JSReference(props) { return ( @@ -22,9 +23,9 @@ export default function JSReference(props) { } export async function getStaticProps() { - return handleRefStaticProps(sections, '/javascript') + return handleRefStaticProps(sections, libraryPath) } -export function getStaticPaths() { - return handleRefGetStaticPaths() +export async function getStaticPaths() { + return handleRefGetStaticPaths(sections, libraryPath) } diff --git a/apps/docs/pages/reference/javascript/crawlers/[...slug].tsx b/apps/docs/pages/reference/javascript/crawlers/[...slug].tsx index df4a97dcdc5..658469669d1 100644 --- a/apps/docs/pages/reference/javascript/crawlers/[...slug].tsx +++ b/apps/docs/pages/reference/javascript/crawlers/[...slug].tsx @@ -1,6 +1,5 @@ import clientLibsCommonSections from '~/../../spec/common-client-libs-sections.json' import typeSpec from '~/../../spec/enrichments/tsdoc_v2/combined.json' -// @ts-expect-error import spec from '~/../../spec/supabase_js_v2.yml' assert { type: 'yml' } import RefSectionHandler from '~/components/reference/RefSectionHandler' import { flattenSections } from '~/lib/helpers' @@ -10,6 +9,7 @@ import { useRouter } from 'next/router' import RefSEO from '~/components/reference/RefSEO' const sections = flattenSections(clientLibsCommonSections) +const libraryPath = '/javascript' export default function JSReference(props) { const router = useRouter() @@ -36,9 +36,9 @@ export default function JSReference(props) { } export async function getStaticProps() { - return handleRefStaticProps(sections, '/javascript') + return handleRefStaticProps(sections, libraryPath) } -export function getStaticPaths() { - return handleRefGetStaticPaths() +export async function getStaticPaths() { + return handleRefGetStaticPaths(sections, libraryPath) } diff --git a/apps/docs/pages/reference/javascript/v1/[...slug].tsx b/apps/docs/pages/reference/javascript/v1/[...slug].tsx index 4dd32c156ca..364b3e667ac 100644 --- a/apps/docs/pages/reference/javascript/v1/[...slug].tsx +++ b/apps/docs/pages/reference/javascript/v1/[...slug].tsx @@ -1,6 +1,6 @@ +import { inspect } from 'util' import clientLibsCommonSections from '~/../../spec/common-client-libs-sections.json' import typeSpec from '~/../../spec/enrichments/tsdoc_v1/combined.json' -// @ts-expect-error import spec from '~/../../spec/supabase_js_v1.yml' assert { type: 'yml' } import RefSectionHandler from '~/components/reference/RefSectionHandler' import { flattenSections } from '~/lib/helpers' @@ -8,6 +8,7 @@ import handleRefGetStaticPaths from '~/lib/mdx/handleRefStaticPaths' import handleRefStaticProps from '~/lib/mdx/handleRefStaticProps' const sections = flattenSections(clientLibsCommonSections) +const libraryPath = '/javascript/v1' export default function JSReference(props) { return ( @@ -22,9 +23,9 @@ export default function JSReference(props) { } export async function getStaticProps() { - return handleRefStaticProps(sections, '/javascript/v1') + return handleRefStaticProps(sections, libraryPath) } -export function getStaticPaths() { - return handleRefGetStaticPaths() +export async function getStaticPaths() { + return handleRefGetStaticPaths(sections, libraryPath) } diff --git a/apps/docs/pages/reference/javascript/v1/crawlers/[...slug].tsx b/apps/docs/pages/reference/javascript/v1/crawlers/[...slug].tsx index 19278fccd67..d040ffa7ec5 100644 --- a/apps/docs/pages/reference/javascript/v1/crawlers/[...slug].tsx +++ b/apps/docs/pages/reference/javascript/v1/crawlers/[...slug].tsx @@ -1,6 +1,5 @@ import clientLibsCommonSections from '~/../../spec/common-client-libs-sections.json' import typeSpec from '~/../../spec/enrichments/tsdoc_v2/combined.json' -// @ts-expect-error import spec from '~/../../spec/supabase_js_v1.yml' assert { type: 'yml' } import RefSectionHandler from '~/components/reference/RefSectionHandler' import { flattenSections } from '~/lib/helpers' @@ -8,7 +7,9 @@ import handleRefGetStaticPaths from '~/lib/mdx/handleRefStaticPaths' import handleRefStaticProps from '~/lib/mdx/handleRefStaticProps' import { useRouter } from 'next/router' import RefSEO from '~/components/reference/RefSEO' + const sections = flattenSections(clientLibsCommonSections) +const libraryPath = '/javascript/v1' export default function JSReference(props) { const router = useRouter() @@ -35,9 +36,9 @@ export default function JSReference(props) { } export async function getStaticProps() { - return handleRefStaticProps(sections, '/javascript/v1') + return handleRefStaticProps(sections, libraryPath) } -export function getStaticPaths() { - return handleRefGetStaticPaths() +export async function getStaticPaths() { + return handleRefGetStaticPaths(sections, libraryPath) } diff --git a/apps/docs/pages/reference/python/[...slug].tsx b/apps/docs/pages/reference/python/[...slug].tsx index a93ce7bcf52..3da995dd993 100644 --- a/apps/docs/pages/reference/python/[...slug].tsx +++ b/apps/docs/pages/reference/python/[...slug].tsx @@ -1,6 +1,5 @@ import clientLibsCommonSections from '~/../../spec/common-client-libs-sections.json' import typeSpec from '~/../../spec/enrichments/tsdoc_v2/combined.json' -// @ts-expect-error import spec from '~/../../spec/supabase_py_v2.yml' assert { type: 'yml' } import RefSectionHandler from '~/components/reference/RefSectionHandler' import { flattenSections } from '~/lib/helpers' @@ -8,6 +7,7 @@ import handleRefGetStaticPaths from '~/lib/mdx/handleRefStaticPaths' import handleRefStaticProps from '~/lib/mdx/handleRefStaticProps' const sections = flattenSections(clientLibsCommonSections) +const libraryPath = '/python' export default function PyReference(props) { return ( @@ -22,9 +22,9 @@ export default function PyReference(props) { } export async function getStaticProps() { - return handleRefStaticProps(sections, '/python') + return handleRefStaticProps(sections, libraryPath) } -export function getStaticPaths() { - return handleRefGetStaticPaths() +export async function getStaticPaths() { + return handleRefGetStaticPaths(sections, libraryPath) } diff --git a/apps/docs/pages/reference/python/crawlers/[...slug].tsx b/apps/docs/pages/reference/python/crawlers/[...slug].tsx index 593da6371f7..ca70d55716f 100644 --- a/apps/docs/pages/reference/python/crawlers/[...slug].tsx +++ b/apps/docs/pages/reference/python/crawlers/[...slug].tsx @@ -1,6 +1,5 @@ import clientLibsCommonSections from '~/../../spec/common-client-libs-sections.json' import typeSpec from '~/../../spec/enrichments/tsdoc_v2/combined.json' -// @ts-expect-error import spec from '~/../../spec/supabase_py_v2.yml' assert { type: 'yml' } import RefSectionHandler from '~/components/reference/RefSectionHandler' import { flattenSections } from '~/lib/helpers' @@ -10,6 +9,7 @@ import { useRouter } from 'next/router' import RefSEO from '~/components/reference/RefSEO' const sections = flattenSections(clientLibsCommonSections) +const libraryPath = '/python' export default function PyReference(props) { const router = useRouter() @@ -36,9 +36,9 @@ export default function PyReference(props) { } export async function getStaticProps() { - return handleRefStaticProps(sections, '/python') + return handleRefStaticProps(sections, libraryPath) } -export function getStaticPaths() { - return handleRefGetStaticPaths() +export async function getStaticPaths() { + return handleRefGetStaticPaths(sections, libraryPath) } diff --git a/apps/docs/pages/reference/realtime/config.tsx b/apps/docs/pages/reference/realtime/config.tsx index eaa7763e7fa..aab317af44d 100644 --- a/apps/docs/pages/reference/realtime/config.tsx +++ b/apps/docs/pages/reference/realtime/config.tsx @@ -4,7 +4,6 @@ import components from '~/components/index' import { MDXRemote } from 'next-mdx-remote' import { serialize } from 'next-mdx-remote/serialize' -// @ts-expect-error import specFile from '~/../../spec/realtime_v0_config.yaml' assert { type: 'yml' } import { Parameter } from '~/lib/refGenerator/refTypes' diff --git a/apps/docs/pages/reference/self-hosting-analytics/[...slug].tsx b/apps/docs/pages/reference/self-hosting-analytics/[...slug].tsx index 5f78d5830ff..46827290444 100644 --- a/apps/docs/pages/reference/self-hosting-analytics/[...slug].tsx +++ b/apps/docs/pages/reference/self-hosting-analytics/[...slug].tsx @@ -7,18 +7,19 @@ import handleRefStaticProps from '~/lib/mdx/handleRefStaticProps' import { gen_v3 } from '~/lib/refGenerator/helpers' const sections = flattenSections(selfHostingAnalyticsCommonSections) +const libraryPath = '/self-hosting-analytics' // @ts-ignore const spec = gen_v3(analyticsSpec, 'wat', { apiUrl: 'apiv0' }) -export default function JSReference(props) { +export default function SelfHostAnalyticsReference(props) { return } export async function getStaticProps() { - return handleRefStaticProps(sections, '/self-hosting-analytics') + return handleRefStaticProps(sections, libraryPath) } -export function getStaticPaths() { - return handleRefGetStaticPaths() +export async function getStaticPaths() { + return handleRefGetStaticPaths(sections, libraryPath) } diff --git a/apps/docs/pages/reference/self-hosting-auth/[...slug].tsx b/apps/docs/pages/reference/self-hosting-auth/[...slug].tsx index c7b2382af16..27e8a909182 100644 --- a/apps/docs/pages/reference/self-hosting-auth/[...slug].tsx +++ b/apps/docs/pages/reference/self-hosting-auth/[...slug].tsx @@ -7,18 +7,19 @@ import handleRefStaticProps from '~/lib/mdx/handleRefStaticProps' import { gen_v3 } from '~/lib/refGenerator/helpers' const sections = flattenSections(selfHostingAuthCommonSections) +const libraryPath = '/self-hosting-auth' // @ts-ignore const spec = gen_v3(authSpec, 'wat', { apiUrl: 'apiv0' }) -export default function JSReference(props) { +export default function SelfHostAuthReference(props) { return } export async function getStaticProps() { - return handleRefStaticProps(sections, '/self-hosting-auth') + return handleRefStaticProps(sections, libraryPath) } -export function getStaticPaths() { - return handleRefGetStaticPaths() +export async function getStaticPaths() { + return handleRefGetStaticPaths(sections, libraryPath) } diff --git a/apps/docs/pages/reference/self-hosting-functions/[...slug].tsx b/apps/docs/pages/reference/self-hosting-functions/[...slug].tsx index cf4639365fb..5d01436b310 100644 --- a/apps/docs/pages/reference/self-hosting-functions/[...slug].tsx +++ b/apps/docs/pages/reference/self-hosting-functions/[...slug].tsx @@ -7,15 +7,16 @@ import handleRefStaticProps from '~/lib/mdx/handleRefStaticProps' import { gen_v3 } from '~/lib/refGenerator/helpers' const sections = flattenSections(selfHostingFunctionsCommonSections) +const libraryPath = '/self-hosting-functions' -export default function JSReference(props) { +export default function SelfHostFunctionsReference(props) { return } export async function getStaticProps() { - return handleRefStaticProps(sections, '/self-hosting-functions') + return handleRefStaticProps(sections, libraryPath) } -export function getStaticPaths() { - return handleRefGetStaticPaths() +export async function getStaticPaths() { + return handleRefGetStaticPaths(sections, libraryPath) } diff --git a/apps/docs/pages/reference/self-hosting-realtime/[...slug].tsx b/apps/docs/pages/reference/self-hosting-realtime/[...slug].tsx index 49e91894a06..c5039628929 100644 --- a/apps/docs/pages/reference/self-hosting-realtime/[...slug].tsx +++ b/apps/docs/pages/reference/self-hosting-realtime/[...slug].tsx @@ -4,18 +4,18 @@ import RefSectionHandler from '~/components/reference/RefSectionHandler' import { flattenSections } from '~/lib/helpers' import handleRefGetStaticPaths from '~/lib/mdx/handleRefStaticPaths' import handleRefStaticProps from '~/lib/mdx/handleRefStaticProps' -import { gen_v3 } from '~/lib/refGenerator/helpers' const sections = flattenSections(selfHostingRealtimeCommonSections) +const libraryPath = '/self-hosting-realtime' -export default function JSReference(props) { +export default function SelfHostRealtimeReference(props) { return } export async function getStaticProps() { - return handleRefStaticProps(sections, '/self-hosting-realtime') + return handleRefStaticProps(sections, libraryPath) } -export function getStaticPaths() { - return handleRefGetStaticPaths() +export async function getStaticPaths() { + return handleRefGetStaticPaths(sections, libraryPath) } diff --git a/apps/docs/pages/reference/self-hosting-storage/[...slug].tsx b/apps/docs/pages/reference/self-hosting-storage/[...slug].tsx index 1b4b99fb9c8..7e55171583e 100644 --- a/apps/docs/pages/reference/self-hosting-storage/[...slug].tsx +++ b/apps/docs/pages/reference/self-hosting-storage/[...slug].tsx @@ -7,18 +7,19 @@ import handleRefStaticProps from '~/lib/mdx/handleRefStaticProps' import { gen_v3 } from '~/lib/refGenerator/helpers' const sections = flattenSections(selfHostingStorageCommonSections) +const libraryPath = '/self-hosting-storage' // @ts-ignore const spec = gen_v3(storageSpec, 'wat', { apiUrl: 'apiv0' }) -export default function JSReference(props) { +export default function SelfHostStorageReference(props) { return } export async function getStaticProps() { - return handleRefStaticProps(sections, '/self-hosting-storage') + return handleRefStaticProps(sections, libraryPath) } -export function getStaticPaths() { - return handleRefGetStaticPaths() +export async function getStaticPaths() { + return handleRefGetStaticPaths(sections, libraryPath) } diff --git a/apps/docs/pages/reference/storage/config.tsx b/apps/docs/pages/reference/storage/config.tsx index 8af901cba03..94dee5d9e55 100644 --- a/apps/docs/pages/reference/storage/config.tsx +++ b/apps/docs/pages/reference/storage/config.tsx @@ -1,4 +1,3 @@ -// @ts-expect-error import specFile from '~/../../spec/storage_v0_config.yaml' assert { type: 'yml' } import { Parameter } from '~/lib/refGenerator/refTypes' diff --git a/apps/docs/pages/reference/swift/[...slug].tsx b/apps/docs/pages/reference/swift/[...slug].tsx index d0e994ed1d6..22cb67c6f98 100644 --- a/apps/docs/pages/reference/swift/[...slug].tsx +++ b/apps/docs/pages/reference/swift/[...slug].tsx @@ -1,5 +1,4 @@ import clientLibsCommonSections from '~/../../spec/common-client-libs-sections.json' -// @ts-expect-error import spec from '~/../../spec/supabase_swift_v0.yml' assert { type: 'yml' } import RefSectionHandler from '~/components/reference/RefSectionHandler' import { flattenSections } from '~/lib/helpers' @@ -7,15 +6,16 @@ import handleRefGetStaticPaths from '~/lib/mdx/handleRefStaticPaths' import handleRefStaticProps from '~/lib/mdx/handleRefStaticProps' const sections = flattenSections(clientLibsCommonSections) +const libraryPath = '/swift' -export default function JSReference(props) { +export default function SwiftReference(props) { return } export async function getStaticProps() { - return handleRefStaticProps(sections, '/swift') + return handleRefStaticProps(sections, libraryPath) } -export function getStaticPaths() { - return handleRefGetStaticPaths() +export async function getStaticPaths() { + return handleRefGetStaticPaths(sections, libraryPath) } diff --git a/apps/docs/pages/reference/swift/crawlers/[...slug].tsx b/apps/docs/pages/reference/swift/crawlers/[...slug].tsx index 308eda7006f..f88e25b8997 100644 --- a/apps/docs/pages/reference/swift/crawlers/[...slug].tsx +++ b/apps/docs/pages/reference/swift/crawlers/[...slug].tsx @@ -1,6 +1,5 @@ import clientLibsCommonSections from '~/../../spec/common-client-libs-sections.json' import typeSpec from '~/../../spec/enrichments/tsdoc_v2/combined.json' -// @ts-expect-error import spec from '~/../../spec/supabase_swift_v0.yml' assert { type: 'yml' } import RefSectionHandler from '~/components/reference/RefSectionHandler' import { flattenSections } from '~/lib/helpers' @@ -10,8 +9,9 @@ import { useRouter } from 'next/router' import RefSEO from '~/components/reference/RefSEO' const sections = flattenSections(clientLibsCommonSections) +const libraryPath = '/swift' -export default function JSReference(props) { +export default function SwiftReference(props) { const router = useRouter() const slug = router.query.slug[0] const filteredSection = sections.filter((section) => section.id === slug) @@ -36,9 +36,9 @@ export default function JSReference(props) { } export async function getStaticProps() { - return handleRefStaticProps(sections, '/swift') + return handleRefStaticProps(sections, libraryPath) } -export function getStaticPaths() { - return handleRefGetStaticPaths() +export async function getStaticPaths() { + return handleRefGetStaticPaths(sections, libraryPath) } diff --git a/apps/docs/pages/reference/swift/v0/[...slug].tsx b/apps/docs/pages/reference/swift/v0/[...slug].tsx index c27937c271f..cdf3662f63b 100644 --- a/apps/docs/pages/reference/swift/v0/[...slug].tsx +++ b/apps/docs/pages/reference/swift/v0/[...slug].tsx @@ -1,5 +1,4 @@ import clientLibsCommonSections from '~/../../spec/common-client-libs-sections.json' -// @ts-expect-error import spec from '~/../../spec/supabase_swift_v0.yml' assert { type: 'yml' } import RefSectionHandler from '~/components/reference/RefSectionHandler' import { flattenSections } from '~/lib/helpers' @@ -7,15 +6,16 @@ import handleRefGetStaticPaths from '~/lib/mdx/handleRefStaticPaths' import handleRefStaticProps from '~/lib/mdx/handleRefStaticProps' const sections = flattenSections(clientLibsCommonSections) +const libraryPath = '/swift/v0' -export default function JSReference(props) { +export default function SwiftReference(props) { return } export async function getStaticProps() { - return handleRefStaticProps(sections, '/swift/v0') + return handleRefStaticProps(sections, libraryPath) } -export function getStaticPaths() { - return handleRefGetStaticPaths() +export async function getStaticPaths() { + return handleRefGetStaticPaths(sections, libraryPath) } diff --git a/apps/docs/pages/reference/swift/v0/crawlers/[...slug].tsx b/apps/docs/pages/reference/swift/v0/crawlers/[...slug].tsx index d89222f1f22..bf3bc4bc449 100644 --- a/apps/docs/pages/reference/swift/v0/crawlers/[...slug].tsx +++ b/apps/docs/pages/reference/swift/v0/crawlers/[...slug].tsx @@ -1,6 +1,5 @@ import clientLibsCommonSections from '~/../../spec/common-client-libs-sections.json' import typeSpec from '~/../../spec/enrichments/tsdoc_v2/combined.json' -// @ts-expect-error import spec from '~/../../spec/supabase_swift_v0.yml' assert { type: 'yml' } import RefSectionHandler from '~/components/reference/RefSectionHandler' import { flattenSections } from '~/lib/helpers' @@ -10,8 +9,9 @@ import { useRouter } from 'next/router' import RefSEO from '~/components/reference/RefSEO' const sections = flattenSections(clientLibsCommonSections) +const libraryPath = '/swift/v0' -export default function JSReference(props) { +export default function SwiftReference(props) { const router = useRouter() const slug = router.query.slug[0] const filteredSection = sections.filter((section) => section.id === slug) @@ -35,9 +35,9 @@ export default function JSReference(props) { } export async function getStaticProps() { - return handleRefStaticProps(sections, '/swift/v0') + return handleRefStaticProps(sections, libraryPath) } -export function getStaticPaths() { - return handleRefGetStaticPaths() +export async function getStaticPaths() { + return handleRefGetStaticPaths(sections, libraryPath) } diff --git a/apps/docs/scripts/search/sources/reference-doc.ts b/apps/docs/scripts/search/sources/reference-doc.ts index 61743a7748f..34a907bb64a 100644 --- a/apps/docs/scripts/search/sources/reference-doc.ts +++ b/apps/docs/scripts/search/sources/reference-doc.ts @@ -3,7 +3,7 @@ import { readFile } from 'fs/promises' import yaml from 'js-yaml' import { OpenAPIV3 } from 'openapi-types' import { - ICommonFunc, + ICommonItem, IFunctionDefinition, ISpec, } from '../../../components/reference/Reference.types' @@ -29,7 +29,7 @@ export abstract class ReferenceSource extends BaseSource { const specContents = await readFile(this.specFilePath, 'utf8') const refSectionsContents = await readFile(this.sectionsFilePath, 'utf8') - const refSections: ICommonFunc[] = JSON.parse(refSectionsContents) + const refSections: ICommonItem[] = JSON.parse(refSectionsContents) const flattenedRefSections = flattenSections(refSections) const checksum = createHash('sha256') @@ -69,7 +69,7 @@ export abstract class ReferenceSource extends BaseSource { abstract getSpecSections(specContents: string): SpecSection[] abstract matchSpecSection(specSections: SpecSection[], id: string): SpecSection - abstract formatSection(specSection: SpecSection, refSection: ICommonFunc): string + abstract formatSection(specSection: SpecSection, refSection: ICommonItem): string } export class OpenApiReferenceSource extends ReferenceSource { @@ -106,7 +106,7 @@ export class ClientLibReferenceSource extends ReferenceSource functionDefinition.id === id) } - formatSection(functionDefinition: IFunctionDefinition, refSection: ICommonFunc): string { + formatSection(functionDefinition: IFunctionDefinition, refSection: ICommonItem): string { const { title } = refSection const { description, title: functionName } = functionDefinition diff --git a/apps/docs/styles/main.scss b/apps/docs/styles/main.scss index dedeb72ffd9..6f627fe2991 100644 --- a/apps/docs/styles/main.scss +++ b/apps/docs/styles/main.scss @@ -8,6 +8,7 @@ url(../../../packages/common/assets/fonts/CustomFont-Book.woff) format('woff'); font-weight: 400; font-style: normal; + font-display: swap; } @font-face { @@ -16,6 +17,7 @@ url(../../../packages/common/assets/fonts/CustomFont-Medium.woff) format('woff'); font-weight: 500; font-style: normal; + font-display: swap; } :root { diff --git a/apps/docs/types/index.ts b/apps/docs/types/index.ts index c1e58ad998a..88cdf87ab6b 100644 --- a/apps/docs/types/index.ts +++ b/apps/docs/types/index.ts @@ -1 +1,3 @@ export * from './next' + +export type Json = string | number | boolean | { [key: string]: Json } | Json[] diff --git a/apps/docs/types/yaml.d.ts b/apps/docs/types/yaml.d.ts new file mode 100644 index 00000000000..519982d6518 --- /dev/null +++ b/apps/docs/types/yaml.d.ts @@ -0,0 +1,13 @@ +declare module '*.yml' { + import { Json } from '.' + + const value: Json + export default value +} + +declare module '*.yaml' { + import { Json } from '.' + + const value: Json + export default value +} diff --git a/package-lock.json b/package-lock.json index 13a13e1880f..f0423b1f5c1 100644 --- a/package-lock.json +++ b/package-lock.json @@ -41,6 +41,7 @@ "@docsearch/react": "^3.3.0", "@mdx-js/loader": "^1.6.22", "@mdx-js/react": "^1.6.22", + "@next/bundle-analyzer": "^13.4.0", "@next/mdx": "^12.0.4", "@octokit/auth-app": "^4.0.9", "@octokit/core": "^4.2.0", @@ -5267,9 +5268,9 @@ } }, "node_modules/@next/bundle-analyzer": { - "version": "13.2.4", - "resolved": "https://registry.npmjs.org/@next/bundle-analyzer/-/bundle-analyzer-13.2.4.tgz", - "integrity": "sha512-bY4Clt7f1roJextpeQOQQWfNiXI0O5UvfOEyfuM5YUGPQMOCAZD2zjLjolakdn9Dm2yyMQUQ6JDE+iJK0dIeLA==", + "version": "13.4.0", + "resolved": "https://registry.npmjs.org/@next/bundle-analyzer/-/bundle-analyzer-13.4.0.tgz", + "integrity": "sha512-3ni7Ple1By7RNk2MB/y4CC4aFJuyI2mYSRxDo8n5VckVJeLVasmmmvzdN45dKzgs8AHu3dPWIsS3+2NJKMyU+A==", "dependencies": { "webpack-bundle-analyzer": "4.7.0" } @@ -43187,9 +43188,9 @@ "integrity": "sha512-3fkKj25kEjsfObL6IlKPAlHYPq/oYwUkkQ03zsTTiDjD7vg/RxjdiLeCydqtxHZP0JgsXL3D/X5oAkMGzuUp/Q==" }, "@next/bundle-analyzer": { - "version": "13.2.4", - "resolved": "https://registry.npmjs.org/@next/bundle-analyzer/-/bundle-analyzer-13.2.4.tgz", - "integrity": "sha512-bY4Clt7f1roJextpeQOQQWfNiXI0O5UvfOEyfuM5YUGPQMOCAZD2zjLjolakdn9Dm2yyMQUQ6JDE+iJK0dIeLA==", + "version": "13.4.0", + "resolved": "https://registry.npmjs.org/@next/bundle-analyzer/-/bundle-analyzer-13.4.0.tgz", + "integrity": "sha512-3ni7Ple1By7RNk2MB/y4CC4aFJuyI2mYSRxDo8n5VckVJeLVasmmmvzdN45dKzgs8AHu3dPWIsS3+2NJKMyU+A==", "requires": { "webpack-bundle-analyzer": "4.7.0" } @@ -51526,6 +51527,7 @@ "@docsearch/react": "^3.3.0", "@mdx-js/loader": "^1.6.22", "@mdx-js/react": "^1.6.22", + "@next/bundle-analyzer": "^13.4.0", "@next/mdx": "^12.0.4", "@octokit/auth-app": "^4.0.9", "@octokit/core": "^4.2.0", diff --git a/packages/ui/package.json b/packages/ui/package.json index e3befbec3fc..7ec616945d6 100644 --- a/packages/ui/package.json +++ b/packages/ui/package.json @@ -4,6 +4,7 @@ "main": "./index.tsx", "types": "./index.tsx", "license": "MIT", + "sideEffects": false, "scripts": { "build:icons": "node --experimental-modules internals/populate-icons.js", "storybook": "start-storybook -p 6006", diff --git a/packages/ui/src/components/Command/CommandMenuProvider.tsx b/packages/ui/src/components/Command/CommandMenuProvider.tsx index 2152b8be161..8457c0ed97d 100644 --- a/packages/ui/src/components/Command/CommandMenuProvider.tsx +++ b/packages/ui/src/components/Command/CommandMenuProvider.tsx @@ -1,6 +1,11 @@ import { useTheme, UseThemeProps } from 'common' +import dynamic from 'next/dynamic' import { createContext, PropsWithChildren, useContext, useEffect, useState } from 'react' -import CommandMenu from './CommandMenu' + +// `CommandMenu` is heavy - code split to reduce app bundle size +const CommandMenu = dynamic(() => import('./CommandMenu'), { + loading: () =>

Loading...

, +}) export interface CommandMenuContextValue { isOpen: boolean diff --git a/spec/common-api-sections.json b/spec/common-api-sections.json index 59bb6396028..13f5c689c57 100644 --- a/spec/common-api-sections.json +++ b/spec/common-api-sections.json @@ -6,6 +6,7 @@ "type": "markdown" }, { + "type": "category", "title": "Projects", "items": [ { @@ -35,6 +36,7 @@ ] }, { + "type": "category", "title": "Secrets", "items": [ { @@ -58,6 +60,7 @@ ] }, { + "type": "category", "title": "Typescript", "items": [ { @@ -69,6 +72,7 @@ ] }, { + "type": "category", "title": "Functions", "items": [ { @@ -109,8 +113,8 @@ } ] }, - { + "type": "category", "title": "Custom Hostname", "items": [ { @@ -146,6 +150,7 @@ ] }, { + "type": "category", "title": "pgsodium", "items": [ { @@ -163,6 +168,7 @@ ] }, { + "type": "category", "title": "Network", "items": [ { diff --git a/spec/common-cli-sections.json b/spec/common-cli-sections.json index e01f4d5ece2..b624e7ec6c5 100644 --- a/spec/common-cli-sections.json +++ b/spec/common-cli-sections.json @@ -14,6 +14,7 @@ "type": "markdown" }, { + "type": "category", "title": "General", "items": [ { @@ -55,6 +56,7 @@ ] }, { + "type": "category", "title": "Testing", "items": [ { @@ -72,6 +74,7 @@ ] }, { + "type": "category", "title": "Generate Types", "items": [ { @@ -95,6 +98,7 @@ ] }, { + "type": "category", "title": "Database", "items": [ { @@ -148,6 +152,7 @@ ] }, { + "type": "category", "title": "Migrations", "items": [ { @@ -177,6 +182,7 @@ ] }, { + "type": "category", "title": "Projects", "items": [ { @@ -200,6 +206,7 @@ ] }, { + "type": "category", "title": "Organizations", "items": [ { @@ -217,6 +224,7 @@ ] }, { + "type": "category", "title": "Edge Functions", "items": [ { @@ -258,6 +266,7 @@ ] }, { + "type": "category", "title": "Secrets", "items": [ { @@ -287,6 +296,7 @@ ] }, { + "type": "category", "title": "Authentication", "items": [ { @@ -334,6 +344,7 @@ ] }, { + "type": "category", "title": "Custom Domains", "items": [ { @@ -375,6 +386,7 @@ ] }, { + "type": "category", "title": "Vanity Subdomains", "items": [ { @@ -410,6 +422,7 @@ ] }, { + "type": "category", "title": "Network Bans", "items": [ { @@ -433,6 +446,7 @@ ] }, { + "type": "category", "title": "Network Restrictions", "items": [ { @@ -456,6 +470,7 @@ ] }, { + "type": "category", "title": "SSL Enforcement", "items": [ { @@ -479,6 +494,7 @@ ] }, { + "type": "category", "title": "Autocompletion Scripts", "items": [ { diff --git a/spec/common-client-libs-sections.json b/spec/common-client-libs-sections.json index aeeeb041b49..1c3937de381 100644 --- a/spec/common-client-libs-sections.json +++ b/spec/common-client-libs-sections.json @@ -53,6 +53,7 @@ ] }, { + "type": "category", "title": "Database", "items": [ { @@ -294,7 +295,7 @@ { "id": "using-modifiers", "isFunc": false, - "title": "Using Modifiers", + "title": "Using modifiers", "slug": "using-modifiers", "product": "database", "parent": "modifiers", @@ -377,6 +378,7 @@ ] }, { + "type": "category", "title": "Auth", "items": [ { @@ -698,6 +700,7 @@ ] }, { + "type": "category", "title": "Functions", "items": [ { @@ -710,6 +713,7 @@ ] }, { + "type": "category", "title": "Realtime", "items": [ { @@ -771,6 +775,7 @@ ] }, { + "type": "category", "title": "Storage", "items": [ { @@ -902,6 +907,7 @@ ] }, { + "type": "category", "title": "Misc", "excludes": [ "reference_dart_v1", diff --git a/spec/common-self-hosting-analytics-sections.json b/spec/common-self-hosting-analytics-sections.json index 21732ffa309..4579dd3a298 100644 --- a/spec/common-self-hosting-analytics-sections.json +++ b/spec/common-self-hosting-analytics-sections.json @@ -7,6 +7,7 @@ "type": "markdown" }, { + "type": "category", "title": "Management API", "items": [ { diff --git a/spec/common-self-hosting-auth-sections.json b/spec/common-self-hosting-auth-sections.json index 82b090de047..2814fb67584 100644 --- a/spec/common-self-hosting-auth-sections.json +++ b/spec/common-self-hosting-auth-sections.json @@ -7,6 +7,7 @@ "type": "markdown" }, { + "type": "category", "title": "Usage", "items": [ { diff --git a/spec/common-self-hosting-storage-sections.json b/spec/common-self-hosting-storage-sections.json index cdcd9bcf537..0e90c80c252 100644 --- a/spec/common-self-hosting-storage-sections.json +++ b/spec/common-self-hosting-storage-sections.json @@ -7,6 +7,7 @@ "type": "markdown" }, { + "type": "category", "title": "Usage", "items": [ {