-
-
Notifications
You must be signed in to change notification settings - Fork 67
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: ParseError on some exactLength expressions (#1222)
- Loading branch information
1 parent
3ac3fd8
commit 30507ba
Showing
115 changed files
with
13,036 additions
and
101 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 |
---|---|---|
|
@@ -10,6 +10,7 @@ tmp | |
.docusaurus | ||
.astro | ||
.next | ||
.source | ||
.cache-loader | ||
.attest | ||
coverage | ||
|
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
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,26 @@ | ||
# my-app | ||
|
||
This is a Next.js application generated with | ||
[Create Fumadocs](https://github.com/fuma-nama/fumadocs). | ||
|
||
Run development server: | ||
|
||
```bash | ||
npm run dev | ||
# or | ||
pnpm dev | ||
# or | ||
yarn dev | ||
``` | ||
|
||
Open http://localhost:3000 with your browser to see the result. | ||
|
||
## Learn More | ||
|
||
To learn more about Next.js and Fumadocs, take a look at the following | ||
resources: | ||
|
||
- [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js | ||
features and API. | ||
- [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial. | ||
- [Fumadocs](https://fumadocs.vercel.app) - learn about Fumadocs |
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,17 @@ | ||
import { HomeLayout } from "fumadocs-ui/layouts/home" | ||
import type { ReactNode } from "react" | ||
import { FloatYourBoat } from "../../components/FloatYourBoat.jsx" | ||
import { baseOptions } from "../layout.config.jsx" | ||
|
||
export type LayoutProps = { | ||
children: ReactNode | ||
} | ||
|
||
export default ({ children }: LayoutProps): React.ReactElement => ( | ||
<HomeLayout | ||
{...baseOptions} | ||
nav={{ ...baseOptions.nav, children: <FloatYourBoat /> }} | ||
> | ||
{children} | ||
</HomeLayout> | ||
) |
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,76 @@ | ||
import { ArkCard, ArkCards } from "../../components/ArkCard" | ||
import { CodeBlock } from "../../components/CodeBlock" | ||
import { Hero } from "../../components/Hero" | ||
import { TsIcon } from "../../components/icons/ts" | ||
import { LinkCard } from "../../components/LinkCard" | ||
import { RuntimeBenchmarksGraph } from "../../components/RuntimeBenchmarksGraph" | ||
|
||
import { | ||
LightbulbIcon, | ||
MessageCircleWarning, | ||
MessageSquareTextIcon, | ||
RocketIcon, | ||
SearchIcon | ||
} from "lucide-react" | ||
|
||
export default () => ( | ||
<div className="flex-1 pt-40 container relative pb-20"> | ||
<Hero /> | ||
<h2 className="text-4xl text-highlight font-semibold mb-3">What awaits</h2> | ||
|
||
<ArkCards> | ||
<ArkCard title="Unparalleled DX" icon={<TsIcon height={20} />}> | ||
<p> | ||
Type syntax you already know with safety and completions unlike | ||
anything you've ever seen | ||
</p> | ||
<CodeBlock fromFile="unparalleledDx" /> | ||
</ArkCard> | ||
<ArkCard title="Faster... everything" icon={<RocketIcon />}> | ||
<p> | ||
100x faster than Zod at runtime with editor performance that will | ||
remind you how autocomplete is supposed to feel | ||
</p> | ||
<RuntimeBenchmarksGraph className="mt-2" /> | ||
</ArkCard> | ||
<ArkCard title="Clarity and Concision" icon={<MessageSquareTextIcon />}> | ||
<p> | ||
Definitions are half as long, type errors are twice as readable, and | ||
hovers tell you just what really matters | ||
</p> | ||
<CodeBlock fromFile="clarityAndConcision" /> | ||
</ArkCard> | ||
<ArkCard title="Better Errors" icon={<MessageCircleWarning />}> | ||
<p>Deeply customizable messages with great defaults</p> | ||
<CodeBlock fromFile="betterErrors" /> | ||
</ArkCard> | ||
<ArkCard title="Deep Introspectability" icon={<SearchIcon />}> | ||
<p> | ||
ArkType uses set theory to understand and expose the relationships | ||
between your types at runtime the way TypeScript does at compile time | ||
</p> | ||
<CodeBlock fromFile="deepIntrospectability" /> | ||
</ArkCard> | ||
<ArkCard title="Intrinsic Optimization" icon={<LightbulbIcon />}> | ||
<p> | ||
Every schema is internally normalized and reduced to its purest and | ||
fastest representation | ||
</p> | ||
<CodeBlock fromFile="intrinsicOptimization" /> | ||
</ArkCard> | ||
{/* <Card title="Portable" icon="seti:json"> | ||
<p> | ||
Most definitions are just objects and strings- take them across the stack or | ||
even outside JS altogether | ||
</p> | ||
</Card> */} | ||
</ArkCards> | ||
|
||
<LinkCard | ||
title="Doc up" | ||
description="Everything you need to know from installation to integration" | ||
href="/docs/intro/setup" | ||
className="sm:mt-16 mt-4" | ||
/> | ||
</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,5 @@ | ||
import { createFromSource } from "fumadocs-core/search/server" | ||
import { source } from "../../../lib/source.js" | ||
// it should be cached forever | ||
export const revalidate = false | ||
export const { staticGET: GET } = createFromSource(source) |
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,78 @@ | ||
import { metadataImage } from "../../../lib/metadata.js" | ||
// import { fromPackageRoot } from "@ark/fs" | ||
import { generateOGImage } from "fumadocs-ui/og" | ||
|
||
export const GET = metadataImage.createAPI(page => | ||
generateOGImage({ | ||
title: page.data.title === "ArkType" ? "ArkType" : "ArkType Docs", | ||
description: | ||
page.data.title === "ArkType" ? page.data.description : page.data.title, | ||
site: "ArkType", | ||
fonts: [ | ||
// fromPackageRoot("src", "assets", "Raleway.ttf"), | ||
// "https://fonts.googleapis.com/css?family=Raleway:300,400,500,700&display=swap" | ||
] | ||
}) | ||
) | ||
|
||
export const generateStaticParams = (): { | ||
slug: string[] | ||
lang?: string | ||
}[] => metadataImage.generateParams() | ||
|
||
// TODO will handle this when moved into arktype repo | ||
// docs: https://fumadocs.vercel.app/docs/ui/open-graph | ||
|
||
// import { fromPackageRoot } from "@ark/fs" | ||
// import { OGImageRoute } from "astro-og-canvas" | ||
// import { getCollection } from "astro:content" | ||
|
||
// // based on https://hideoo.dev/notes/starlight-og-images/ | ||
|
||
// // Get all entries from the `docs` content collection. | ||
// const entries = await getCollection("docs") | ||
|
||
// let defaultDescription = "" | ||
|
||
// // Map the entry array to an object with the page ID as key and the | ||
// // frontmatter data as value. | ||
// const pages = Object.fromEntries( | ||
// entries.map(({ data, id }) => { | ||
// if (id === "index.mdx") defaultDescription = data.description! | ||
// return [id, { data }] | ||
// }) | ||
// ) | ||
|
||
// export const { getStaticPaths, GET } = OGImageRoute({ | ||
// // Pass down the documentation pages. | ||
// pages, | ||
// // Define the name of the parameter used in the endpoint path, here `slug` | ||
// // as the file is named `[...slug].ts`. | ||
// param: "slug", | ||
// // Define a function called for each page to customize the generated image. | ||
// getImageOptions: (_path, page: (typeof pages)[number]) => ({ | ||
// // Use the page title and description as the image title and description. | ||
// title: page.data.title === "ArkType" ? "ArkType" : "ArkType Docs", | ||
// description: | ||
// page.data.title === "ArkType" ? defaultDescription : page.data.title, | ||
// bgImage: { | ||
// path: fromPackageRoot("src", "assets", "openGraphBackground.png") | ||
// }, | ||
// font: { | ||
// title: { | ||
// families: ["Raleway"], | ||
// weight: "Bold", | ||
// size: 100 | ||
// }, | ||
// description: { | ||
// families: ["Raleway"], | ||
// weight: "SemiBold", | ||
// size: 40 | ||
// } | ||
// }, | ||
// fonts: [ | ||
// fromPackageRoot("src", "assets", "Raleway.ttf"), | ||
// "https://fonts.googleapis.com/css?family=Raleway:300,400,500,700&display=swap" | ||
// ] | ||
// }) | ||
// }) |
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,57 @@ | ||
import { Popup, PopupContent, PopupTrigger } from "fumadocs-twoslash/ui" | ||
import { CodeBlock, Pre } from "fumadocs-ui/components/codeblock" | ||
import defaultMdxComponents from "fumadocs-ui/mdx" | ||
import { | ||
DocsBody, | ||
DocsDescription, | ||
DocsPage, | ||
DocsTitle | ||
} from "fumadocs-ui/page" | ||
import { notFound } from "next/navigation" | ||
import { source } from "../../../lib/source.js" | ||
|
||
export default async (props: { params: Promise<{ slug?: string[] }> }) => { | ||
const params = await props.params | ||
const page = source.getPage(params.slug) | ||
if (!page) notFound() | ||
|
||
const MDX = page.data.body | ||
|
||
return ( | ||
<DocsPage toc={page.data.toc} full={page.data.full ?? false}> | ||
<DocsTitle>{page.data.title}</DocsTitle> | ||
<DocsDescription>{page.data.description}</DocsDescription> | ||
<DocsBody> | ||
<MDX | ||
components={{ | ||
...defaultMdxComponents, | ||
Popup, | ||
PopupContent, | ||
PopupTrigger, | ||
|
||
pre: ({ ref: _, ...props }) => ( | ||
<CodeBlock {...props}> | ||
<Pre>{props.children}</Pre> | ||
</CodeBlock> | ||
) | ||
}} | ||
/> | ||
</DocsBody> | ||
</DocsPage> | ||
) | ||
} | ||
|
||
export const generateStaticParams = async () => source.generateParams() | ||
|
||
export const generateMetadata = async (props: { | ||
params: Promise<{ slug?: string[] }> | ||
}) => { | ||
const params = await props.params | ||
const page = source.getPage(params.slug) | ||
if (!page) notFound() | ||
|
||
return { | ||
title: page.data.title, | ||
description: page.data.description | ||
} | ||
} |
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 @@ | ||
import { DocsLayout } from "fumadocs-ui/layouts/docs" | ||
import type { ReactNode } from "react" | ||
import { source } from "../../lib/source.js" | ||
import { baseOptions } from "../layout.config.jsx" | ||
|
||
export default ({ children }: { children: ReactNode }) => ( | ||
<DocsLayout tree={source.pageTree} {...baseOptions}> | ||
{children} | ||
</DocsLayout> | ||
) |
Oops, something went wrong.