@vercel/geistdocs 2.15.2 → 2.15.3-canary.7d55dcf

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (64) hide show
  1. package/dist/cli/index.js +1 -1
  2. package/dist/internal/mdx-to-markdown.d.ts.map +1 -1
  3. package/dist/internal/mdx-to-markdown.js +9 -0
  4. package/dist/internal/page-actions.d.ts +4 -4
  5. package/dist/internal/page-actions.d.ts.map +1 -1
  6. package/dist/internal/page-actions.js +6 -1
  7. package/dist/internal/source-loader.d.ts +28 -0
  8. package/dist/internal/source-loader.d.ts.map +1 -0
  9. package/dist/internal/source-loader.js +77 -0
  10. package/dist/mdx-basic.d.ts +27 -0
  11. package/dist/mdx-basic.d.ts.map +1 -0
  12. package/dist/mdx-basic.js +61 -0
  13. package/dist/mdx.d.ts +3 -25
  14. package/dist/mdx.d.ts.map +1 -1
  15. package/dist/mdx.js +8 -61
  16. package/dist/navigation.d.ts +11 -0
  17. package/dist/navigation.d.ts.map +1 -0
  18. package/dist/navigation.js +8 -0
  19. package/dist/next.d.ts +9 -1
  20. package/dist/next.d.ts.map +1 -1
  21. package/dist/next.js +25 -2
  22. package/dist/pages/docs-custom.d.ts +111 -0
  23. package/dist/pages/docs-custom.d.ts.map +1 -0
  24. package/dist/pages/docs-custom.js +250 -0
  25. package/dist/pages/docs.d.ts +5 -98
  26. package/dist/pages/docs.d.ts.map +1 -1
  27. package/dist/pages/docs.js +13 -250
  28. package/dist/source-config.d.ts +10 -1
  29. package/dist/source-config.d.ts.map +1 -1
  30. package/dist/source-config.js +20 -10
  31. package/dist/source.d.ts +6 -17
  32. package/dist/source.d.ts.map +1 -1
  33. package/dist/source.js +2 -75
  34. package/docs/agents.md +1 -1
  35. package/docs/llms.txt +9 -1
  36. package/docs/manifest.json +1 -1
  37. package/docs/pages/configuration.md +8 -0
  38. package/native-mdx/LICENSE-mdxjs-rs +22 -0
  39. package/native-mdx/binaries/darwin-arm64.node +0 -0
  40. package/native-mdx/binaries/linux-x64-gnu.node +0 -0
  41. package/native-mdx/data-entry.d.mts +15 -0
  42. package/native-mdx/data-entry.mjs +97 -0
  43. package/native-mdx/data-projection.mjs +205 -0
  44. package/native-mdx/index-emitter.mjs +34 -0
  45. package/native-mdx/loader-data.cjs +36 -0
  46. package/native-mdx/loader-mdx.cjs +9 -0
  47. package/native-mdx/loader-mdx.mjs +262 -0
  48. package/native-mdx/native-binding.cjs +25 -0
  49. package/native-mdx/navigation-entry.d.mts +11 -0
  50. package/native-mdx/navigation-entry.mjs +136 -0
  51. package/native-mdx/navigation-title.mjs +53 -0
  52. package/package.json +36 -8
  53. package/rehype-code-highlights.d.ts +13 -0
  54. package/rehype-code-highlights.js +230 -0
  55. package/source-config.js +24 -10
  56. package/template/app/[lang]/(home)/opengraph-image.tsx +4 -28
  57. package/template/app/[lang]/og/[...slug]/route.tsx +5 -68
  58. package/template/content/docs/configuration.mdx +8 -0
  59. package/template/lib/geistdocs/geist-mono-regular.ttf +0 -0
  60. package/template/lib/geistdocs/og.tsx +95 -0
  61. package/template/package.json +1 -1
  62. package/template/app/[lang]/og/[...slug]/background.png +0 -0
  63. package/template/app/[lang]/og/[...slug]/geist-sans-semibold.ttf +0 -0
  64. /package/template/{app/[lang]/og/[...slug] → lib/geistdocs}/geist-sans-regular.ttf +0 -0
@@ -1,7 +1,6 @@
1
- import { readFile } from "node:fs/promises";
2
- import { join } from "node:path";
3
- import { ImageResponse } from "next/og";
4
1
  import type { NextRequest } from "next/server";
2
+ import { config } from "@/lib/geistdocs/config";
3
+ import { createOpenGraphImage } from "@/lib/geistdocs/og";
5
4
  import { getPageImage, source } from "@/lib/geistdocs/source";
6
5
 
7
6
  export const GET = async (
@@ -15,71 +14,9 @@ export const GET = async (
15
14
  return new Response("Not found", { status: 404 });
16
15
  }
17
16
 
18
- const { title, description } = page.data;
19
-
20
- const regularFont = await readFile(
21
- join(process.cwd(), "app/[lang]/og/[...slug]/geist-sans-regular.ttf")
22
- );
23
-
24
- const semiboldFont = await readFile(
25
- join(process.cwd(), "app/[lang]/og/[...slug]/geist-sans-semibold.ttf")
26
- );
27
-
28
- const backgroundImage = await readFile(
29
- join(process.cwd(), "app/[lang]/og/[...slug]/background.png")
30
- );
31
-
32
- const backgroundImageData = backgroundImage.buffer.slice(
33
- backgroundImage.byteOffset,
34
- backgroundImage.byteOffset + backgroundImage.byteLength
35
- );
36
-
37
- return new ImageResponse(
38
- <div style={{ fontFamily: "Geist" }} tw="flex h-full w-full bg-black">
39
- {/** biome-ignore lint/performance/noImgElement: "Required for Satori" */}
40
- <img
41
- alt="Vercel OpenGraph Background"
42
- height={628}
43
- src={backgroundImageData as never}
44
- width={1200}
45
- />
46
- <div tw="flex flex-col absolute h-full w-[750px] justify-center left-[50px] pr-[50px] pt-[116px] pb-[86px]">
47
- <div
48
- style={{
49
- textWrap: "balance",
50
- }}
51
- tw="text-5xl font-medium text-white tracking-tight flex leading-[1.1] mb-4"
52
- >
53
- {title}
54
- </div>
55
- <div
56
- style={{
57
- color: "#8B8B8B",
58
- lineHeight: "44px",
59
- textWrap: "balance",
60
- }}
61
- tw="text-[32px]"
62
- >
63
- {description}
64
- </div>
65
- </div>
66
- </div>,
67
- {
68
- width: 1200,
69
- height: 628,
70
- fonts: [
71
- {
72
- name: "Geist",
73
- data: regularFont,
74
- weight: 400,
75
- },
76
- {
77
- name: "Geist",
78
- data: semiboldFont,
79
- weight: 500,
80
- },
81
- ],
82
- }
17
+ return createOpenGraphImage(
18
+ page.data.title ?? config.title,
19
+ page.data.description
83
20
  );
84
21
  };
85
22
 
@@ -283,6 +283,14 @@ export const docs = defineDocs({
283
283
  export default defineGeistdocsSourceConfig();
284
284
  ```
285
285
 
286
+ ### Code highlighter
287
+
288
+ Code blocks are tokenized by [Highlights](https://diffs.com/highlights), which uses hand-written WebAssembly lexers, and rendered with the same HTML as Shiki: Geist colors, titles, icons, tabs, and `[!code ...]` notation all work. Languages without a built-in Highlights lexer render as plain text. To use Shiki's TextMate grammars instead, for example for an unsupported language, pass `highlighter: "shiki"`:
289
+
290
+ ```ts title="source.config.ts"
291
+ export default defineGeistdocsSourceConfig({ highlighter: "shiki" });
292
+ ```
293
+
286
294
  To serve docs from the site root, use `route: "/"` in `content` and `baseUrl: "/"` in `createSource`. Root-mounted docs need explicit `markdownRoutes`; Geistdocs does not infer a broad `/*path` mapping because it can capture homepages and non-docs app routes.
287
295
 
288
296
  ## Page URLs
@@ -0,0 +1,95 @@
1
+ import { readFile } from "node:fs/promises";
2
+ import { join } from "node:path";
3
+ import { LogoIconVercelSvg } from "@vercel/geistdocs/assets/logos";
4
+ import { ImageResponse } from "next/og";
5
+ import { renderToReadableStream } from "react-dom/server.edge";
6
+
7
+ const regularFont = readFile(
8
+ join(process.cwd(), "lib/geistdocs/geist-sans-regular.ttf")
9
+ );
10
+ const monoFont = readFile(
11
+ join(process.cwd(), "lib/geistdocs/geist-mono-regular.ttf")
12
+ );
13
+
14
+ export const createOpenGraphImage = async (
15
+ title: string,
16
+ subheading?: string
17
+ ) => {
18
+ // Satori cannot resolve the memoized base component used by Geist icons.
19
+ const logo = await new Response(
20
+ await renderToReadableStream(<LogoIconVercelSvg size={60} />)
21
+ ).text();
22
+
23
+ return new ImageResponse(
24
+ <div
25
+ style={{
26
+ backgroundColor: "#000",
27
+ color: "#fff",
28
+ display: "flex",
29
+ fontFamily: "Geist",
30
+ height: "100%",
31
+ width: "100%",
32
+ }}
33
+ >
34
+ <div style={{ display: "flex", left: 64, position: "absolute", top: 56 }}>
35
+ {/** biome-ignore lint/performance/noImgElement: Required for Satori. */}
36
+ <img
37
+ alt="Vercel"
38
+ height={60}
39
+ src={`data:image/svg+xml;base64,${Buffer.from(logo.replaceAll("currentColor", "#fff")).toString("base64")}`}
40
+ width={60}
41
+ />
42
+ </div>
43
+ <div
44
+ style={{
45
+ display: "flex",
46
+ flexDirection: "column",
47
+ gap: 24,
48
+ left: 64,
49
+ position: "absolute",
50
+ top: 220,
51
+ width: 810,
52
+ }}
53
+ >
54
+ <div
55
+ style={{
56
+ display: "block",
57
+ fontSize: 80,
58
+ fontWeight: 400,
59
+ letterSpacing: "-0.05em",
60
+ ...(subheading ? { lineClamp: 3 } : {}),
61
+ lineHeight: 0.95,
62
+ textWrap: subheading ? "wrap" : "balance",
63
+ width: "100%",
64
+ }}
65
+ >
66
+ {title}
67
+ </div>
68
+ {subheading ? (
69
+ <div
70
+ style={{
71
+ color: "#a1a1a1",
72
+ display: "block",
73
+ fontFamily: "Geist Mono",
74
+ fontSize: 32,
75
+ lineClamp: 2,
76
+ lineHeight: 1.25,
77
+ textWrap: "wrap",
78
+ width: "100%",
79
+ }}
80
+ >
81
+ {subheading}
82
+ </div>
83
+ ) : null}
84
+ </div>
85
+ </div>,
86
+ {
87
+ width: 1200,
88
+ height: 630,
89
+ fonts: [
90
+ { name: "Geist", data: await regularFont, weight: 400 },
91
+ { name: "Geist Mono", data: await monoFont, weight: 400 },
92
+ ],
93
+ }
94
+ );
95
+ };
@@ -17,7 +17,7 @@
17
17
  "@streamdown/code": "^1.0.1",
18
18
  "@vercel/agent-readability": "^0.7.0",
19
19
  "@vercel/analytics": "^1.6.1",
20
- "@vercel/geistdocs": "2.15.2",
20
+ "@vercel/geistdocs": "2.15.3-canary.7d55dcf",
21
21
  "@vercel/speed-insights": "^1.3.1",
22
22
  "ai": "^6.0.132",
23
23
  "clsx": "^2.1.1",