@vercel/geistdocs 1.27.0 → 1.28.1

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 (41) hide show
  1. package/dist/changelog.d.ts +36 -0
  2. package/dist/changelog.d.ts.map +1 -0
  3. package/dist/changelog.js +143 -0
  4. package/dist/cli/index.js +1 -1
  5. package/dist/internal/changelog-entries.d.ts +8 -0
  6. package/dist/internal/changelog-entries.d.ts.map +1 -0
  7. package/dist/internal/changelog-entries.js +25 -0
  8. package/dist/internal/changelog-feed.d.ts +10 -0
  9. package/dist/internal/changelog-feed.d.ts.map +1 -0
  10. package/dist/internal/changelog-feed.js +89 -0
  11. package/dist/internal/changelog.d.ts +36 -0
  12. package/dist/internal/changelog.d.ts.map +1 -0
  13. package/dist/internal/changelog.js +98 -0
  14. package/dist/internal/markdown-negotiation.d.ts +2 -0
  15. package/dist/internal/markdown-negotiation.d.ts.map +1 -0
  16. package/dist/internal/markdown-negotiation.js +3 -0
  17. package/dist/pages/changelog.d.ts +31 -0
  18. package/dist/pages/changelog.d.ts.map +1 -0
  19. package/dist/pages/changelog.js +86 -0
  20. package/dist/proxy.d.ts +3 -1
  21. package/dist/proxy.d.ts.map +1 -1
  22. package/dist/proxy.js +18 -29
  23. package/dist/routes/changelog.d.ts +43 -0
  24. package/dist/routes/changelog.d.ts.map +1 -0
  25. package/dist/routes/changelog.js +81 -0
  26. package/dist/routes/not-found.d.ts.map +1 -1
  27. package/dist/routes/not-found.js +3 -3
  28. package/docs/agents.md +2 -1
  29. package/docs/llms.txt +413 -4
  30. package/docs/manifest.json +10 -1
  31. package/docs/pages/changelog.md +385 -0
  32. package/docs/pages/md.md +1 -1
  33. package/docs/pages/proxy.md +21 -2
  34. package/docs/sitemap.md +1 -0
  35. package/package.json +14 -1
  36. package/template/content/docs/changelog.mdx +382 -0
  37. package/template/content/docs/md.mdx +1 -1
  38. package/template/content/docs/meta.json +1 -0
  39. package/template/content/docs/proxy.cn.mdx +1 -1
  40. package/template/content/docs/proxy.mdx +21 -2
  41. package/template/package.json +1 -1
@@ -0,0 +1,86 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { notFound, redirect } from "next/navigation";
3
+ import { getChangelogPage, getChangelogPageParams, getChangelogPagePath, getChangelogPath, parseChangelogPage, } from "../internal/changelog";
4
+ import { ChangelogFeed } from "../internal/changelog-feed";
5
+ import { getGeistdocsLanguageConfig } from "../internal/languages";
6
+ import { GeistdocsPageActions } from "../internal/page-actions-client";
7
+ const TRAILING_SLASH_PATTERN = /\/$/;
8
+ export const createChangelogPage = (options) => {
9
+ const { config, source, path = "/changelog", title = "Changelog", description = "The latest releases, improvements, and fixes.", getLang, markdownPath, dataPath, pageSize = 10, } = options;
10
+ const { languages } = getGeistdocsLanguageConfig(config);
11
+ const resolveLang = async ({ params }) => {
12
+ const lang = getLang ? await getLang() : (await params).lang;
13
+ if (!languages.includes(lang)) {
14
+ notFound();
15
+ }
16
+ return lang;
17
+ };
18
+ const markdownHref = (lang, page) => page === 1
19
+ ? getChangelogPath(config, markdownPath, lang)
20
+ : `${getChangelogPagePath(config, path, lang, page)}.md`;
21
+ const metadataForPage = (lang, page) => {
22
+ const canonicalPath = getChangelogPagePath(config, path, lang, page);
23
+ const canonical = config.siteUrl
24
+ ? new URL(canonicalPath, config.siteUrl).toString()
25
+ : canonicalPath;
26
+ const pageTitle = page === 1 ? title : `${title} - Page ${page}`;
27
+ return {
28
+ title: pageTitle,
29
+ description,
30
+ alternates: {
31
+ canonical,
32
+ ...(markdownPath
33
+ ? { types: { "text/markdown": markdownHref(lang, page) } }
34
+ : {}),
35
+ },
36
+ openGraph: {
37
+ title: pageTitle,
38
+ description,
39
+ type: "website",
40
+ url: canonical,
41
+ },
42
+ };
43
+ };
44
+ const renderPage = async (lang, page) => {
45
+ const data = await getChangelogPage({ source, lang, page, pageSize });
46
+ if (!data) {
47
+ notFound();
48
+ }
49
+ const actionPage = {
50
+ markdownUrl: markdownHref(lang, page),
51
+ url: getChangelogPagePath(config, path, lang, page),
52
+ };
53
+ return (_jsxs("main", { className: "mx-auto w-full max-w-[1080px] px-6 pt-16 pb-32 font-sans sm:px-10 lg:pt-24", id: "geistdocs-changelog", children: [_jsxs("header", { className: "border-gray-400 border-b pb-12 lg:pb-16", children: [_jsxs("div", { className: "flex flex-col-reverse gap-4 md:flex-row md:items-end md:justify-between", children: [_jsx("h1", { className: "text-gray-1000 text-heading-40 tracking-tighter", children: title }), markdownPath ? (_jsx(GeistdocsPageActions, { config: config, only: "desktop", page: actionPage })) : null] }), _jsx("p", { className: "mt-5 max-w-xl text-balance text-gray-900 text-lg leading-8", children: description }), markdownPath ? (_jsx("div", { className: "mt-5 @min-[961px]:hidden", children: _jsx(GeistdocsPageActions, { config: config, only: "mobile", page: actionPage }) })) : null, page > 1 ? (_jsxs("p", { className: "mt-5 text-gray-900 text-sm", children: ["Page ", page] })) : null] }), _jsx(ChangelogFeed, { dataPath: getChangelogPath(config, dataPath ?? `${path.replace(TRAILING_SLASH_PATTERN, "")}/data`, lang), initialPage: data, lang: lang, path: getChangelogPath(config, path, lang) }, `${lang}:${page}`)] }));
54
+ };
55
+ const Page = async (props) => renderPage(await resolveLang(props), 1);
56
+ const generateMetadata = async (props) => metadataForPage(await resolveLang(props), 1);
57
+ const resolveArchive = async (props) => {
58
+ const lang = await resolveLang(props);
59
+ const page = parseChangelogPage((await props.params).page);
60
+ if (page === null) {
61
+ notFound();
62
+ }
63
+ if (page === 1) {
64
+ redirect(getChangelogPath(config, path, lang));
65
+ }
66
+ return { lang, page };
67
+ };
68
+ const PaginatedPage = async (props) => {
69
+ const { lang, page } = await resolveArchive(props);
70
+ return renderPage(lang, page);
71
+ };
72
+ const generatePaginatedMetadata = async (props) => {
73
+ const { lang, page } = await resolveArchive(props);
74
+ return metadataForPage(lang, page);
75
+ };
76
+ const generateStaticParams = () => languages.map((lang) => ({ lang }));
77
+ const generatePageParams = ({ params, } = {}) => getChangelogPageParams(options, params?.lang);
78
+ return {
79
+ Page,
80
+ PaginatedPage,
81
+ generateMetadata,
82
+ generatePaginatedMetadata,
83
+ generateStaticParams,
84
+ generatePageParams,
85
+ };
86
+ };
package/dist/proxy.d.ts CHANGED
@@ -27,6 +27,8 @@ export interface GeistdocsMarkdownRoute {
27
27
  }) => `/${string}`);
28
28
  }
29
29
  export interface CreateProxyOptions {
30
+ /** Prepend standalone Markdown mappings without replacing docs mappings. */
31
+ additionalMarkdownRoutes?: GeistdocsMarkdownRoute[];
30
32
  after?: GeistdocsProxyHook | GeistdocsProxyHook[];
31
33
  before?: GeistdocsProxyHook | GeistdocsProxyHook[];
32
34
  config: Pick<GeistdocsConfig, "agent" | "basePath" | "content" | "defaultLanguage" | "translations">;
@@ -38,6 +40,6 @@ export interface CreateProxyOptions {
38
40
  markdownRoutes?: GeistdocsMarkdownRoute[];
39
41
  trackMarkdownRequest?: (event: TrackMarkdownRequestEvent) => Promise<void> | void;
40
42
  }
41
- export declare const createProxy: ({ after, before, config, markdownNotFound, markdownRoutes, trackMarkdownRequest, }: CreateProxyOptions) => (request: NextRequest, context: NextFetchEvent) => Promise<Response>;
43
+ export declare const createProxy: ({ additionalMarkdownRoutes, after, before, config, markdownNotFound, markdownRoutes, trackMarkdownRequest, }: CreateProxyOptions) => (request: NextRequest, context: NextFetchEvent) => Promise<Response>;
42
44
  export {};
43
45
  //# sourceMappingURL=proxy.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"proxy.d.ts","sourceRoot":"","sources":["../src/proxy.ts"],"names":[],"mappings":"AAQA,OAAO,EACL,KAAK,cAAc,EACnB,KAAK,WAAW,EAEjB,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,KAAK,eAAe,EAGrB,MAAM,UAAU,CAAC;AAQlB,MAAM,MAAM,eAAe,GACvB,UAAU,GACV,iBAAiB,GACjB,WAAW,GACX,IAAI,CAAC;AAET,MAAM,WAAW,yBAAyB;IACxC,YAAY,EAAE,MAAM,GAAG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AAsB;IACrC,IAAI,EAAE,IAAI,MAAM,EAAE,CAAC;IACnB,EAAE,EACE,IAAI,MAAM,EAAE,GACZ,CAAC,CAAC,OAAO,EAAE;QACT,eAAe,EAAE,MAAM,CAAC;QACxB,QAAQ,EAAE,MAAM,CAAC;QACjB,IAAI,EAAE,MAAM,EAAE,CAAC;QACf,QAAQ,EAAE,MAAM,CAAC;KAClB,KAAK,IAAI,MAAM,EAAE,CAAC,CAAC;CACzB;AAED,MAAM,WAAW,kBAAkB;IACjC,4EAA4E;IAC5E,wBAAwB,CAAC,EAAE,sBAAsB,EAAE,CAAC;IACpD,KAAK,CAAC,EAAE,kBAAkB,GAAG,kBAAkB,EAAE,CAAC;IAClD,MAAM,CAAC,EAAE,kBAAkB,GAAG,kBAAkB,EAAE,CAAC;IACnD,MAAM,EAAE,IAAI,CACV,eAAe,EACf,OAAO,GAAG,UAAU,GAAG,SAAS,GAAG,iBAAiB,GAAG,cAAc,CACtE,CAAC;IACF,sFAAsF;IACtF,gBAAgB,CAAC,EACb,OAAO,GACP,CAAC,CAAC,OAAO,EAAE;QAAE,QAAQ,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAA;KAAE,KAAK,OAAO,CAAC,CAAC;IACnE,cAAc,CAAC,EAAE,sBAAsB,EAAE,CAAC;IAC1C,oBAAoB,CAAC,EAAE,CACrB,KAAK,EAAE,yBAAyB,KAC7B,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;CAC3B;AAoKD,eAAO,MAAM,WAAW,GAAI,8GAQzB,kBAAkB,MAqRL,SAAS,WAAW,EAAE,SAAS,cAAc,sBAoD5D,CAAC"}
package/dist/proxy.js CHANGED
@@ -1,10 +1,10 @@
1
- import { applyMarkdownHeaders, createNotFoundResponse, isAIAgent, } from "@vercel/agent-readability";
1
+ import { applyMarkdownHeaders, createNotFoundResponse, } from "@vercel/agent-readability";
2
2
  import { defineI18n } from "fumadocs-core/i18n";
3
3
  import { createI18nMiddleware } from "fumadocs-core/i18n/middleware";
4
- import { isMarkdownPreferred } from "fumadocs-core/negotiation";
5
4
  import { NextResponse, } from "next/server";
6
5
  import { getPublicPath, normalizeBasePath, } from "./config";
7
6
  import { matchesAppRoute, parseAppRouteManifest, } from "./internal/app-route-manifest";
7
+ import { getMarkdownDecision } from "./internal/markdown-negotiation";
8
8
  import { renderNotFoundMarkdown } from "./internal/not-found";
9
9
  import { localizeHref } from "./localize-href";
10
10
  const MDX_EXTENSION_PATTERN = /\.mdx?$/;
@@ -121,10 +121,13 @@ const getLocalizedPathname = (pathname, languages, defaultLanguage) => {
121
121
  pathname: `/${segments.slice(1).join("/")}`,
122
122
  };
123
123
  };
124
- export const createProxy = ({ after, before, config, markdownNotFound, markdownRoutes, trackMarkdownRequest, }) => {
124
+ export const createProxy = ({ additionalMarkdownRoutes, after, before, config, markdownNotFound, markdownRoutes, trackMarkdownRequest, }) => {
125
125
  const agentEnabled = config.agent !== undefined && config.agent.enabled !== false;
126
- const contentRouteMappings = markdownRoutes ??
127
- inferMarkdownRoutes(config) ?? [DEFAULT_MARKDOWN_ROUTE];
126
+ const contentRouteMappings = [
127
+ ...(additionalMarkdownRoutes ?? []),
128
+ ...(markdownRoutes ??
129
+ inferMarkdownRoutes(config) ?? [DEFAULT_MARKDOWN_ROUTE]),
130
+ ];
128
131
  const routeMappings = agentEnabled
129
132
  ? [...contentRouteMappings, HOME_MARKDOWN_ROUTE]
130
133
  : contentRouteMappings;
@@ -227,27 +230,16 @@ export const createProxy = ({ after, before, config, markdownNotFound, markdownR
227
230
  trackPath,
228
231
  });
229
232
  };
230
- const handleAgentRewrite = (request, context, pathname, language, trackPath) => {
231
- const agentResult = isAIAgent(request);
232
- if (!agentResult.detected || isMarkdownPreferred(request)) {
233
+ const handleNegotiatedMarkdownRequest = (request, context, pathname, language, trackPath, decision) => {
234
+ if (!decision.serve) {
233
235
  return null;
234
236
  }
235
- const response = tryMarkdownRewrite(request, context, pathname, language, {
236
- requestType: "agent-rewrite",
237
- detectionMethod: agentResult.method,
237
+ return tryMarkdownRewrite(request, context, pathname, language, {
238
+ requestType: decision.reason === "agent" ? "agent-rewrite" : "header-negotiated",
239
+ detectionMethod: decision.reason === "agent" ? decision.detection.method : undefined,
238
240
  trackPath,
239
241
  });
240
- if (response) {
241
- return response;
242
- }
243
- return createNotFoundResponse(pathname);
244
242
  };
245
- const handlePreferredMarkdownRequest = (request, context, pathname, language, trackPath) => isMarkdownPreferred(request)
246
- ? tryMarkdownRewrite(request, context, pathname, language, {
247
- requestType: "header-negotiated",
248
- trackPath,
249
- })
250
- : null;
251
243
  const handleMarkdownNegotiation = (request, context, pathname) => {
252
244
  if (!MARKDOWN_REQUEST_METHODS.has(request.method)) {
253
245
  return null;
@@ -261,19 +253,16 @@ export const createProxy = ({ after, before, config, markdownNotFound, markdownR
261
253
  if (extensionResponse) {
262
254
  return extensionResponse;
263
255
  }
256
+ const markdownDecision = getMarkdownDecision(request);
264
257
  if (resolveMarkdownRewrite(localized.pathname, localized.language) &&
265
258
  !localized.pathname.includes("/llms.mdx/")) {
266
- const agentResponse = handleAgentRewrite(request, context, localized.pathname, localized.language, pathname);
267
- if (agentResponse) {
268
- return agentResponse;
259
+ const negotiatedResponse = handleNegotiatedMarkdownRequest(request, context, localized.pathname, localized.language, pathname, markdownDecision);
260
+ if (negotiatedResponse) {
261
+ return negotiatedResponse;
269
262
  }
270
263
  }
271
- const preferredResponse = handlePreferredMarkdownRequest(request, context, localized.pathname, localized.language, pathname);
272
- if (preferredResponse) {
273
- return preferredResponse;
274
- }
275
264
  return !RESOURCE_EXTENSION_PATTERN.test(localized.pathname) &&
276
- (isMarkdownPreferred(request) || isAIAgent(request).detected) &&
265
+ markdownDecision.serve &&
277
266
  shouldCreateMarkdownNotFound(localized.pathname, localized.language, pathname)
278
267
  ? createMarkdownNotFound(pathname, localized.language)
279
268
  : null;
@@ -0,0 +1,43 @@
1
+ import { type ChangelogPageOptions } from "../internal/changelog";
2
+ export type CreateChangelogMarkdownRouteOptions = ChangelogPageOptions;
3
+ export type CreateChangelogDataRouteOptions = ChangelogPageOptions;
4
+ export declare const createChangelogMarkdownRoute: ({ config, source, path, title, description, markdownPath, pageSize, }: CreateChangelogMarkdownRouteOptions) => {
5
+ GET: (_request: Request, { params }: {
6
+ params: Promise<{
7
+ lang?: string;
8
+ page?: string;
9
+ }>;
10
+ }) => Promise<Response>;
11
+ generateStaticParams: ({ params, }?: {
12
+ params?: {
13
+ lang?: string;
14
+ };
15
+ }) => {
16
+ lang: string;
17
+ }[];
18
+ generatePageParams: ({ params, }?: {
19
+ params?: {
20
+ lang?: string;
21
+ };
22
+ }) => Promise<{
23
+ lang: string;
24
+ page: string;
25
+ }[]>;
26
+ };
27
+ export declare const createChangelogDataRoute: (options: CreateChangelogDataRouteOptions) => {
28
+ GET: (_request: Request, { params }: {
29
+ params: Promise<{
30
+ lang?: string;
31
+ page?: string;
32
+ }>;
33
+ }) => Promise<Response>;
34
+ generateStaticParams: ({ params, }?: {
35
+ params?: {
36
+ lang?: string;
37
+ };
38
+ }) => Promise<{
39
+ lang: string;
40
+ page: string;
41
+ }[]>;
42
+ };
43
+ //# sourceMappingURL=changelog.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"changelog.d.ts","sourceRoot":"","sources":["../../src/routes/changelog.ts"],"names":[],"mappings":"AACA,OAAO,EACL,KAAK,oBAAoB,EAO1B,MAAM,uBAAuB,CAAC;AAG/B,MAAM,MAAM,mCAAmC,GAAG,oBAAoB,CAAC;AACvE,MAAM,MAAM,+BAA+B,GAAG,oBAAoB,CAAC;AAWnE,eAAO,MAAM,4BAA4B,GAAI,uEAQ1C,mCAAmC;oBAIxB,OAAO,cACL;QAAE,MAAM,EAAE,OAAO,CAAC;YAAE,IAAI,CAAC,EAAE,MAAM,CAAC;YAAC,IAAI,CAAC,EAAE,MAAM,CAAA;SAAE,CAAC,CAAA;KAAE;yCAkDhE;QACD,MAAM,CAAC,EAAE;YAAE,IAAI,CAAC,EAAE,MAAM,CAAA;SAAE,CAAC;KAC5B;;;uCAWE;QACD,MAAM,CAAC,EAAE;YAAE,IAAI,CAAC,EAAE,MAAM,CAAA;SAAE,CAAC;KAC5B;;;;CAMF,CAAC;AAEF,eAAO,MAAM,wBAAwB,GACnC,SAAS,+BAA+B;oBAM5B,OAAO,cACL;QAAE,MAAM,EAAE,OAAO,CAAC;YAAE,IAAI,CAAC,EAAE,MAAM,CAAC;YAAC,IAAI,CAAC,EAAE,MAAM,CAAA;SAAE,CAAC,CAAA;KAAE;yCAgBhE;QACD,MAAM,CAAC,EAAE;YAAE,IAAI,CAAC,EAAE,MAAM,CAAA;SAAE,CAAC;KAC5B;;;;CAYF,CAAC"}
@@ -0,0 +1,81 @@
1
+ import { applyMarkdownHeaders } from "@vercel/agent-readability";
2
+ import { getChangelogEntryTitle, getChangelogPage, getChangelogPageParams, getChangelogPagePath, getChangelogPath, parseChangelogPage, } from "../internal/changelog";
3
+ import { getGeistdocsLanguageConfig } from "../internal/languages";
4
+ const LINE_BREAK_PATTERN = /[\r\n\u2028\u2029]+/g;
5
+ const HEADING_MARKDOWN_PATTERN = /([\\`*_{}[\]<>#|~])/g;
6
+ const TRAILING_SLASH_PATTERN = /\/+$/;
7
+ const escapeHeading = (value) => value
8
+ .replace(LINE_BREAK_PATTERN, " ")
9
+ .replace(HEADING_MARKDOWN_PATTERN, "\\$1");
10
+ export const createChangelogMarkdownRoute = ({ config, source, path = "/changelog", title = "Changelog", description, markdownPath, pageSize, }) => {
11
+ const { defaultLanguage, languages } = getGeistdocsLanguageConfig(config);
12
+ const GET = async (_request, { params }) => {
13
+ const { lang = defaultLanguage, page: pageParam } = await params;
14
+ const page = parseChangelogPage(pageParam);
15
+ if (!languages.includes(lang) || page === null) {
16
+ return new Response("Not Found", { status: 404 });
17
+ }
18
+ const data = await getChangelogPage({ source, lang, page, pageSize });
19
+ if (!data) {
20
+ return new Response("Not Found", { status: 404 });
21
+ }
22
+ const canonicalPath = getChangelogPagePath(config, path, lang, page);
23
+ const headers = applyMarkdownHeaders(new Headers({ "Content-Type": "text/markdown; charset=utf-8" }), {
24
+ canonicalUrl: config.siteUrl
25
+ ? new URL(canonicalPath, config.siteUrl)
26
+ : canonicalPath,
27
+ });
28
+ const releases = data.entries.map((entry) => `## ${escapeHeading(getChangelogEntryTitle(entry))} {#${entry.id}}\n\n${entry.publishedAt ? `${entry.publishedAt}\n\n` : ""}${entry.body}`);
29
+ const markdownPagePath = (number) => number === 1
30
+ ? getChangelogPath(config, markdownPath ??
31
+ `${path.replace(TRAILING_SLASH_PATTERN, "") || "/"}.md`, lang)
32
+ : `${getChangelogPagePath(config, path, lang, number)}.md`;
33
+ return new Response([
34
+ `# ${escapeHeading(page === 1 ? title : `${title} - Page ${page}`)}`,
35
+ ...(description ? [description] : []),
36
+ ...releases,
37
+ ...(page > 1 ? [`[Previous](${markdownPagePath(page - 1)})`] : []),
38
+ ...(data.nextPage
39
+ ? [`[Next](${markdownPagePath(data.nextPage)})`]
40
+ : []),
41
+ ].join("\n\n"), { headers });
42
+ };
43
+ const generateStaticParams = ({ params, } = {}) => {
44
+ const { lang } = params ?? {};
45
+ return (lang === undefined
46
+ ? languages
47
+ : languages.filter((language) => language === lang)).map((language) => ({ lang: language }));
48
+ };
49
+ const generatePageParams = ({ params, } = {}) => {
50
+ const { lang } = params ?? {};
51
+ return getChangelogPageParams({ config, source, pageSize }, lang);
52
+ };
53
+ return { GET, generateStaticParams, generatePageParams };
54
+ };
55
+ export const createChangelogDataRoute = (options) => {
56
+ const { config, source, pageSize } = options;
57
+ const { defaultLanguage, languages } = getGeistdocsLanguageConfig(config);
58
+ const GET = async (_request, { params }) => {
59
+ const { lang = defaultLanguage, page: pageParam } = await params;
60
+ const page = parseChangelogPage(pageParam);
61
+ if (!languages.includes(lang) || page === null) {
62
+ return new Response("Not Found", { status: 404 });
63
+ }
64
+ const data = await getChangelogPage({ source, lang, page, pageSize });
65
+ if (!data) {
66
+ return new Response("Not Found", { status: 404 });
67
+ }
68
+ return Response.json(data);
69
+ };
70
+ const generateStaticParams = async ({ params, } = {}) => {
71
+ const { lang } = params ?? {};
72
+ const archives = await getChangelogPageParams(options, lang);
73
+ return languages
74
+ .filter((language) => lang === undefined || language === lang)
75
+ .flatMap((language) => [
76
+ { lang: language, page: "1" },
77
+ ...archives.filter((archive) => archive.lang === language),
78
+ ]);
79
+ };
80
+ return { GET, generateStaticParams };
81
+ };
@@ -1 +1 @@
1
- {"version":3,"file":"not-found.d.ts","sourceRoot":"","sources":["../../src/routes/not-found.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,EAAE,KAAK,eAAe,EAAiB,MAAM,WAAW,CAAC;AAIhE,MAAM,WAAW,0BAA0B;IACzC,MAAM,EAAE,IAAI,CACV,eAAe,EACf,UAAU,GAAG,iBAAiB,GAAG,cAAc,CAChD,CAAC;CACH;AASD,eAAO,MAAM,mBAAmB,GAAI,YAAY,0BAA0B;mBAE7D,WAAW,cACR;QAAE,MAAM,EAAE,OAAO,CAAC;YAAE,IAAI,CAAC,EAAE,MAAM,CAAA;SAAE,CAAC,CAAA;KAAE;CA+DrD,CAAC"}
1
+ {"version":3,"file":"not-found.d.ts","sourceRoot":"","sources":["../../src/routes/not-found.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,EAAE,KAAK,eAAe,EAAiB,MAAM,WAAW,CAAC;AAKhE,MAAM,WAAW,0BAA0B;IACzC,MAAM,EAAE,IAAI,CACV,eAAe,EACf,UAAU,GAAG,iBAAiB,GAAG,cAAc,CAChD,CAAC;CACH;AASD,eAAO,MAAM,mBAAmB,GAAI,YAAY,0BAA0B;mBAE7D,WAAW,cACR;QAAE,MAAM,EAAE,OAAO,CAAC;YAAE,IAAI,CAAC,EAAE,MAAM,CAAA;SAAE,CAAC,CAAA;KAAE;CA+DrD,CAAC"}
@@ -1,6 +1,6 @@
1
- import { createNotFoundResponse, isAIAgent } from "@vercel/agent-readability";
2
- import { isMarkdownPreferred } from "fumadocs-core/negotiation";
1
+ import { createNotFoundResponse } from "@vercel/agent-readability";
3
2
  import { getPublicPath } from "../config";
3
+ import { getMarkdownDecision } from "../internal/markdown-negotiation";
4
4
  import { renderNotFoundMarkdown } from "../internal/not-found";
5
5
  import { localizeHref } from "../localize-href";
6
6
  const escapeHtml = (value) => value
@@ -24,7 +24,7 @@ export const createNotFoundRoute = ({ config }) => {
24
24
  const sitemapUrl = publicPath("/sitemap.md");
25
25
  const llmsUrl = publicPath("/llms.txt");
26
26
  const vary = "Accept, User-Agent, Signature-Agent";
27
- if (isMarkdownPreferred(request) || isAIAgent(request).detected) {
27
+ if (getMarkdownDecision(request).serve) {
28
28
  return createNotFoundResponse(request.nextUrl.pathname, {
29
29
  headers: {
30
30
  "Cache-Control": "private, no-store",
package/docs/agents.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Geistdocs Package Docs
2
2
 
3
- These docs are bundled with `@vercel/geistdocs` 1.27.0 so agents can understand the installed package without web access.
3
+ These docs are bundled with `@vercel/geistdocs` 1.28.1 so agents can understand the installed package without web access.
4
4
  They are generated from `apps/template/content/docs` during the package build.
5
5
 
6
6
  ## How to use these files
@@ -32,6 +32,7 @@ They are generated from `apps/template/content/docs` during the package build.
32
32
  - [Geistdocs Provider](pages/provider.md): The root provider component that wraps your application to handle toast notifications, search, and analytics.
33
33
  - [Versioned docs](pages/versioned-docs.md): Use createVersionedSources to configure stable, pre-release, or host-based documentation versions.
34
34
  - [Proxy and markdown routes](pages/proxy.md): Configure createProxy with generated route discovery, request hooks, markdown mappings, and a static Next.js matcher.
35
+ - [Add a changelog](pages/changelog.md): Connect collection or paged ChangelogSource data to five thin HTML, Markdown, and JSON adapters, preserving existing docs mappings.
35
36
  - [.md Extension](pages/md.md): Access any documentation page as raw Markdown by appending .md or .mdx to the URL for AI tool consumption.
36
37
  - [Agent readiness](pages/agent-readiness.md): Generate /agents.md and /.well-known/mcp.json from Geistdocs config so agents can find docs, Markdown surfaces, API specs, and MCP endpoints.
37
38
  - [Ask AI](pages/ask-ai.md): An AI-powered chat assistant with context-aware search, persistent history, and suggested prompts for your documentation.