-
Notifications
You must be signed in to change notification settings - Fork 54
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/main' into feat/prevent-recursiv…
…e-fallback-throw-error
- Loading branch information
Showing
160 changed files
with
1,039 additions
and
853 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
prefer-workspace-packages=true | ||
enable-pre-post-scripts=true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# transforms testfixtures | ||
packages/codemods/src/transforms/testfixtures/** |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -33,3 +33,5 @@ yarn-error.log* | |
# typescript | ||
*.tsbuildinfo | ||
next-env.d.ts | ||
|
||
_pagefind/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,9 +12,9 @@ | |
"bugs": "https://github.com/toss/suspensive/issues", | ||
"license": "MIT", | ||
"author": "Jonghyeon Ko <[email protected]>", | ||
"type": "commonjs", | ||
"type": "module", | ||
"scripts": { | ||
"build": "next build", | ||
"build": "next build && pagefind --site .next/server/app --output-path public/_pagefind", | ||
"ci:eslint": "eslint \"**/*.{ts,tsx,cts,mts,mdx}\"", | ||
"ci:type": "tsc --noEmit", | ||
"clean": "rimraf ./.next && rimraf ./node_modules", | ||
|
@@ -23,6 +23,7 @@ | |
}, | ||
"dependencies": { | ||
"@codesandbox/sandpack-react": "^2.19.10", | ||
"@next/third-parties": "^15.1.6", | ||
"@suspensive/react": "workspace:*", | ||
"@suspensive/react-query-4": "workspace:*", | ||
"@tanstack/react-query": "^4.36.1", | ||
|
@@ -31,8 +32,8 @@ | |
"d3": "^7.9.0", | ||
"motion": "^11.13.5", | ||
"next": "catalog:", | ||
"nextra": "^3.3.1", | ||
"nextra-theme-docs": "^3.3.1", | ||
"nextra": "^4.1.0", | ||
"nextra-theme-docs": "^4.1.0", | ||
"react": "catalog:react19", | ||
"react-dom": "catalog:react19", | ||
"remark-sandpack": "^0.0.5", | ||
|
@@ -41,11 +42,11 @@ | |
}, | ||
"devDependencies": { | ||
"@suspensive/eslint-config": "workspace:*", | ||
"@tailwindcss/postcss": "catalog:", | ||
"@types/d3": "^7.4.3", | ||
"@types/react": "catalog:react19", | ||
"@types/react-dom": "catalog:react19", | ||
"autoprefixer": "catalog:", | ||
"postcss": "catalog:", | ||
"pagefind": "^1.3.0", | ||
"prettier-plugin-tailwindcss": "catalog:", | ||
"tailwindcss": "catalog:" | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
module.exports = { | ||
/** @type {import('postcss').Postcss} */ | ||
export default { | ||
plugins: { | ||
tailwindcss: {}, | ||
autoprefixer: {}, | ||
'@tailwindcss/postcss': {}, | ||
}, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Binary file not shown.
File renamed without changes
File renamed without changes
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 10 additions & 0 deletions
10
docs/suspensive.org/src/app/[lang]/[[...mdxPath]]/FadeIn.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
'use client' | ||
|
||
import { motion } from 'motion/react' | ||
import type { ReactNode } from 'react' | ||
|
||
export const FadeIn = ({ children }: { children: ReactNode }) => ( | ||
<motion.div initial={{ opacity: 0, y: 8 }} animate={{ opacity: 1, y: 0 }}> | ||
{children} | ||
</motion.div> | ||
) |
38 changes: 38 additions & 0 deletions
38
docs/suspensive.org/src/app/[lang]/[[...mdxPath]]/page.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import type { Heading, NextraMetadata } from 'nextra' | ||
import { generateStaticParamsFor, importPage } from 'nextra/pages' | ||
import { FadeIn } from './FadeIn' | ||
import { useMDXComponents } from '@/mdx-components' | ||
|
||
type Page = { | ||
toc: Array<Heading> | ||
metadata: NextraMetadata | ||
default: React.ComponentType<{ params: Awaited<PageProps['params']> }> | ||
} | ||
export const generateStaticParams = generateStaticParamsFor('mdxPath') | ||
|
||
type PageProps = Readonly<{ | ||
params: Promise<{ mdxPath?: string[]; lang: string }> | ||
}> | ||
export const generateMetadata = async (props: PageProps) => { | ||
const params = await props.params | ||
const page = (await importPage(params.mdxPath, params.lang)) as Page | ||
return page.metadata | ||
} | ||
// eslint-disable-next-line react-hooks/rules-of-hooks | ||
const Wrapper = useMDXComponents().wrapper | ||
export default async function Page(props: PageProps) { | ||
const params = await props.params | ||
const page = (await importPage(params.mdxPath, params.lang)) as Page | ||
|
||
return ( | ||
<Wrapper toc={page.toc} metadata={page.metadata}> | ||
{page.metadata.filePath.includes('index.mdx') ? ( | ||
<page.default {...props} params={params} /> | ||
) : ( | ||
<FadeIn key={params.mdxPath?.join('/')}> | ||
<page.default {...props} params={params} /> | ||
</FadeIn> | ||
)} | ||
</Wrapper> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
'use client' | ||
|
||
import { motion } from 'motion/react' | ||
import Image from 'next/image' | ||
|
||
export const Logo = () => { | ||
return ( | ||
<motion.div | ||
className="flex items-center gap-1" | ||
whileHover={{ scale: 1.05 }} | ||
whileTap={{ scale: 0.95 }} | ||
> | ||
<motion.span> | ||
<Image | ||
src="/img/logo_dark.png" | ||
width={34} | ||
height={34} | ||
alt="suspensive logo" | ||
/> | ||
</motion.span> | ||
<div className="relative"> | ||
<strong>Suspensive</strong> | ||
<span className="absolute text-[8px]">v2</span> | ||
</div> | ||
</motion.div> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,110 @@ | ||
/* eslint-env node */ | ||
import { GoogleAnalytics, GoogleTagManager } from '@next/third-parties/google' | ||
import { ClientOnly } from '@suspensive/react' | ||
import type { Metadata } from 'next' | ||
import Script from 'next/script' | ||
import { Banner, Head, Search } from 'nextra/components' | ||
import { getPageMap } from 'nextra/page-map' | ||
import { | ||
Footer, | ||
LastUpdated, | ||
Layout, | ||
LocaleSwitch, | ||
Navbar, | ||
} from 'nextra-theme-docs' | ||
import type { ReactNode } from 'react' | ||
import { getDictionary, getDirection } from '../_dictionaries/get-dictionary' | ||
import './styles.css' | ||
import { Logo } from './_components/Logo' | ||
import { SandPackCSS } from '@/components/Sandpack/SandPackCSS' | ||
|
||
export const metadata = { | ||
title: { | ||
absolute: 'Suspensive', | ||
template: '%s | Suspensive', | ||
default: 'Suspensive', | ||
}, | ||
description: 'All in one for React Suspense', | ||
metadataBase: new URL('https://swr.vercel.app'), | ||
openGraph: { images: '/img/banner.png' }, | ||
icons: '/img/favicon.ico', | ||
} satisfies Metadata | ||
|
||
export default async function RootLayout({ | ||
children, | ||
params, | ||
}: { | ||
children: ReactNode | ||
params: Promise<{ lang: 'en' | 'ko' }> | ||
}) { | ||
const { lang } = await params | ||
const dictionary = await getDictionary(lang) | ||
const pageMap = await getPageMap(lang) | ||
|
||
return ( | ||
<html lang={lang} dir={getDirection(lang)} suppressHydrationWarning> | ||
<Head backgroundColor={{ dark: 'rgb(0,0,0)' }}> | ||
<ClientOnly> | ||
<SandPackCSS /> | ||
</ClientOnly> | ||
</Head> | ||
<body> | ||
<Layout | ||
darkMode={false} | ||
banner={ | ||
<Banner storageKey="suspensive banner">{dictionary.banner}</Banner> | ||
} | ||
search={<Search placeholder={dictionary.search.placeholder} />} | ||
navbar={ | ||
<Navbar | ||
logo={<Logo />} | ||
projectLink="https://github.com/toss/suspensive" | ||
chatLink="https://discord.gg/RFcR9WWmCH" | ||
> | ||
<LocaleSwitch /> | ||
</Navbar> | ||
} | ||
footer={ | ||
<Footer> | ||
MIT {new Date().getFullYear()} © Viva Republica, Inc. | ||
</Footer> | ||
} | ||
docsRepositoryBase="https://github.com/toss/suspensive/tree/main/docs/suspensive.org" | ||
i18n={[ | ||
{ locale: 'en', name: 'English' }, | ||
{ locale: 'ko', name: '한국어' }, | ||
]} | ||
sidebar={{ | ||
defaultMenuCollapseLevel: 4, | ||
autoCollapse: true, | ||
toggleButton: true, | ||
}} | ||
toc={{ | ||
...dictionary.toc, | ||
float: true, | ||
}} | ||
editLink={dictionary.editPage} | ||
pageMap={pageMap} | ||
nextThemes={{ defaultTheme: 'dark' }} | ||
feedback={{ content: '' }} | ||
lastUpdated={<LastUpdated>{dictionary.lastUpdated}</LastUpdated>} | ||
> | ||
{children} | ||
</Layout> | ||
<GoogleTagManager gtmId="G-NYQZGKRL0Y" /> | ||
<GoogleAnalytics gaId="G-NYQZGKRL0Y" /> | ||
<ClientOnly> | ||
<Script id="microsoft-clarity" type="text/javascript"> | ||
{` | ||
(function(c,l,a,r,i,t,y){ | ||
c[a]=c[a]||function(){(c[a].q=c[a].q||[]).push(arguments)}; | ||
t=l.createElement(r);t.async=1;t.src="https://www.clarity.ms/tag/"+i; | ||
y=l.getElementsByTagName(r)[0];y.parentNode.insertBefore(t,y); | ||
})(window, document, "clarity", "script", "jnyd3uxeuz"); | ||
`} | ||
</Script> | ||
</ClientOnly> | ||
</body> | ||
</html> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export { NotFoundPage as default } from 'nextra-theme-docs' |
5 changes: 2 additions & 3 deletions
5
docs/suspensive.org/src/styles/globals.css → .../suspensive.org/src/app/[lang]/styles.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import { Link } from 'nextra-theme-docs' | ||
|
||
export default { | ||
toc: { | ||
title: 'On This Page', | ||
backToTop: 'Scroll to top', | ||
}, | ||
search: { placeholder: 'Search Documentation...' }, | ||
footer: { | ||
editLink: 'Edit this page on GitHub', | ||
}, | ||
banner: ( | ||
<span> | ||
👀 Check out the changes in Suspensive v2.{' '} | ||
<Link href="/en/docs/migrate-to-v2">read more →</Link> | ||
</span> | ||
), | ||
lastUpdated: 'Last updated on', | ||
editPage: 'Edit this page on GitHub', | ||
} |
22 changes: 22 additions & 0 deletions
22
docs/suspensive.org/src/app/_dictionaries/get-dictionary.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import 'server-only' | ||
import type En from './en' | ||
|
||
// We enumerate all dictionaries here for better linting and TypeScript support | ||
// We also get the default import for cleaner types | ||
const dictionaries = { | ||
en: () => import('./en'), | ||
ko: () => import('./ko'), | ||
} as const satisfies Record<string, () => Promise<{ default: typeof En }>> | ||
|
||
export const getDictionary = async ( | ||
locale: keyof typeof dictionaries | ||
): Promise<typeof En> => (await dictionaries[locale]()).default | ||
|
||
export const getDirection = (locale: keyof typeof dictionaries) => { | ||
switch (locale) { | ||
case 'en': | ||
case 'ko': | ||
default: | ||
return 'ltr' as const | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import { Link } from 'nextra-theme-docs' | ||
import type En from './en' | ||
|
||
export default { | ||
toc: { | ||
title: '이 페이지', | ||
backToTop: '맨 위로', | ||
}, | ||
search: { placeholder: '검색어를 입력하세요...' }, | ||
footer: { | ||
editLink: 'Edit this page on GitHub', | ||
}, | ||
banner: ( | ||
<span> | ||
👀 Suspensive v2에서의 변경을 확인하세요.{' '} | ||
<Link href="/ko/docs/migrate-to-v2">더보기 →</Link> | ||
</span> | ||
), | ||
lastUpdated: '수정된 날짜:', | ||
editPage: 'GitHub에서 이 페이지 수정하기', | ||
} satisfies typeof En |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.