@vercel/geistdocs 2.15.4-canary.2a54b38 → 2.16.0
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.
- package/dist/cli/index.js +1 -1
- package/dist/config.d.ts +3 -3
- package/dist/config.d.ts.map +1 -1
- package/dist/internal/mdx-to-markdown.d.ts.map +1 -1
- package/dist/internal/mdx-to-markdown.js +0 -9
- package/dist/internal/navbar/mobile-menu.d.ts +3 -3
- package/dist/internal/navbar/mobile-menu.d.ts.map +1 -1
- package/dist/internal/navbar/mobile-menu.js +3 -3
- package/dist/internal/navbar/navbar-logo.d.ts +5 -3
- package/dist/internal/navbar/navbar-logo.d.ts.map +1 -1
- package/dist/internal/navbar/navbar-logo.js +71 -14
- package/dist/internal/page-actions.d.ts +4 -4
- package/dist/internal/page-actions.d.ts.map +1 -1
- package/dist/internal/page-actions.js +1 -6
- package/dist/mdx.d.ts +25 -3
- package/dist/mdx.d.ts.map +1 -1
- package/dist/mdx.js +61 -8
- package/dist/navbar.js +4 -3
- package/dist/next.d.ts +1 -11
- package/dist/next.d.ts.map +1 -1
- package/dist/next.js +2 -82
- package/dist/pages/docs.d.ts +98 -5
- package/dist/pages/docs.d.ts.map +1 -1
- package/dist/pages/docs.js +250 -13
- package/dist/source-config.d.ts +1 -10
- package/dist/source-config.d.ts.map +1 -1
- package/dist/source-config.js +10 -21
- package/dist/source.d.ts +17 -6
- package/dist/source.d.ts.map +1 -1
- package/dist/source.js +75 -2
- package/docs/agents.md +1 -1
- package/docs/llms.txt +8 -22
- package/docs/manifest.json +1 -1
- package/docs/pages/configuration.md +7 -21
- package/package.json +19 -40
- package/rehype-code-highlights.d.ts +1 -1
- package/rehype-code-highlights.js +49 -1
- package/source-config-public.d.ts +15 -0
- package/source-config-public.js +47 -0
- package/source-config.js +10 -27
- package/template/content/docs/configuration.mdx +7 -21
- package/template/package.json +4 -7
- package/dist/internal/source-loader.d.ts +0 -28
- package/dist/internal/source-loader.d.ts.map +0 -1
- package/dist/internal/source-loader.js +0 -77
- package/dist/mdx-basic.d.ts +0 -27
- package/dist/mdx-basic.d.ts.map +0 -1
- package/dist/mdx-basic.js +0 -61
- package/dist/navigation.d.ts +0 -11
- package/dist/navigation.d.ts.map +0 -1
- package/dist/navigation.js +0 -8
- package/dist/pages/docs-custom.d.ts +0 -111
- package/dist/pages/docs-custom.d.ts.map +0 -1
- package/dist/pages/docs-custom.js +0 -250
- package/native-mdx/LICENSE-mdxjs-rs +0 -22
- package/native-mdx/UPSTREAM.md +0 -16
- package/native-mdx/binaries/darwin-arm64.node +0 -0
- package/native-mdx/binaries/linux-x64-gnu.node +0 -0
- package/native-mdx/data-entry.d.mts +0 -15
- package/native-mdx/data-entry.mjs +0 -97
- package/native-mdx/data-projection.mjs +0 -205
- package/native-mdx/fumadocs-adapter.mjs +0 -36
- package/native-mdx/index-emitter.mjs +0 -34
- package/native-mdx/loader-data.cjs +0 -36
- package/native-mdx/loader-mdx.cjs +0 -9
- package/native-mdx/loader-mdx.mjs +0 -419
- package/native-mdx/native-binding.cjs +0 -27
- package/native-mdx/navigation-entry.d.mts +0 -11
- package/native-mdx/navigation-entry.mjs +0 -136
- package/native-mdx/navigation-title.mjs +0 -53
- package/template/pnpm-workspace.yaml +0 -3
package/dist/next.js
CHANGED
|
@@ -1,76 +1,6 @@
|
|
|
1
|
-
import { fileURLToPath } from "node:url";
|
|
2
1
|
import { createMDX } from "fumadocs-mdx/next";
|
|
3
2
|
import { APP_ROUTE_MANIFEST_DEFINE, APP_ROUTE_MANIFEST_ENV, } from "./internal/app-route-manifest.js";
|
|
4
3
|
import { mergeRewriteRoutes, scanAppRouteManifest, } from "./internal/app-route-scanner.js";
|
|
5
|
-
const FUMADOCS_MDX_LOADER = "fumadocs-mdx/loader-mdx";
|
|
6
|
-
/** Replace only Fumadocs' MDX loader, preserving config and user rules. */
|
|
7
|
-
const replaceMdxLoader = (config, loader, mode) => {
|
|
8
|
-
const replace = (entry) => {
|
|
9
|
-
if (entry === FUMADOCS_MDX_LOADER) {
|
|
10
|
-
return { loader, options: { geistdocsMdxCompiler: mode } };
|
|
11
|
-
}
|
|
12
|
-
if (entry &&
|
|
13
|
-
typeof entry === "object" &&
|
|
14
|
-
"loader" in entry &&
|
|
15
|
-
entry.loader === FUMADOCS_MDX_LOADER) {
|
|
16
|
-
const options = "options" in entry && entry.options && typeof entry.options === "object"
|
|
17
|
-
? entry.options
|
|
18
|
-
: {};
|
|
19
|
-
return {
|
|
20
|
-
...entry,
|
|
21
|
-
loader,
|
|
22
|
-
options: { ...options, geistdocsMdxCompiler: mode },
|
|
23
|
-
};
|
|
24
|
-
}
|
|
25
|
-
return entry;
|
|
26
|
-
};
|
|
27
|
-
const rules = config.turbopack?.rules;
|
|
28
|
-
const turbopack = rules
|
|
29
|
-
? {
|
|
30
|
-
...config.turbopack,
|
|
31
|
-
rules: Object.fromEntries(Object.entries(rules).map(([pattern, rule]) => {
|
|
32
|
-
if (!(rule &&
|
|
33
|
-
typeof rule === "object" &&
|
|
34
|
-
"loaders" in rule &&
|
|
35
|
-
rule.loaders)) {
|
|
36
|
-
return [pattern, rule];
|
|
37
|
-
}
|
|
38
|
-
return [pattern, { ...rule, loaders: rule.loaders.map(replace) }];
|
|
39
|
-
})),
|
|
40
|
-
}
|
|
41
|
-
: config.turbopack;
|
|
42
|
-
function rewriteRule(entry) {
|
|
43
|
-
if (!entry || typeof entry !== "object") {
|
|
44
|
-
return;
|
|
45
|
-
}
|
|
46
|
-
const rule = entry;
|
|
47
|
-
for (const key of ["oneOf", "rules"]) {
|
|
48
|
-
if (Array.isArray(rule[key])) {
|
|
49
|
-
rewriteRules(rule[key]);
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
if (rule.loader === FUMADOCS_MDX_LOADER) {
|
|
53
|
-
Object.assign(rule, replace(rule));
|
|
54
|
-
}
|
|
55
|
-
if (Array.isArray(rule.use)) {
|
|
56
|
-
rule.use = rule.use.map(replace);
|
|
57
|
-
}
|
|
58
|
-
else if (rule.use) {
|
|
59
|
-
rule.use = replace(rule.use);
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
function rewriteRules(entries) {
|
|
63
|
-
for (const entry of entries) {
|
|
64
|
-
rewriteRule(entry);
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
const webpack = (input, context) => {
|
|
68
|
-
const output = config.webpack?.(input, context) ?? input;
|
|
69
|
-
rewriteRules(output.module?.rules ?? []);
|
|
70
|
-
return output;
|
|
71
|
-
};
|
|
72
|
-
return { ...config, turbopack, webpack };
|
|
73
|
-
};
|
|
74
4
|
const hasOwn = (value, key) => value ? Object.hasOwn(value, key) : false;
|
|
75
5
|
const assertManifestKeyIsAvailable = (config) => {
|
|
76
6
|
if (hasOwn(config.env, APP_ROUTE_MANIFEST_ENV) ||
|
|
@@ -88,19 +18,9 @@ const flattenRewrites = (rewrites) => Array.isArray(rewrites)
|
|
|
88
18
|
];
|
|
89
19
|
/** Compose Fumadocs MDX with Geistdocs App Router discovery. */
|
|
90
20
|
export const createGeistdocs = (options = {}) => {
|
|
91
|
-
const
|
|
92
|
-
if (!["auto", "native", "js"].includes(mdxCompiler)) {
|
|
93
|
-
throw new Error(`Invalid mdxCompiler: ${mdxCompiler}`);
|
|
94
|
-
}
|
|
95
|
-
const withMDX = createMDX(mdxOptions);
|
|
96
|
-
const mdxLoader = experimentalMdxLoader ??
|
|
97
|
-
process.env.GEISTDOCS_MDX_LOADER ??
|
|
98
|
-
fileURLToPath(new URL("../native-mdx/loader-mdx.cjs", import.meta.url));
|
|
21
|
+
const withMDX = createMDX(options);
|
|
99
22
|
return async (nextConfig = {}) => {
|
|
100
|
-
const
|
|
101
|
-
const config = mdxCompiler === "js"
|
|
102
|
-
? withFumadocs
|
|
103
|
-
: replaceMdxLoader(withFumadocs, mdxLoader, mdxCompiler);
|
|
23
|
+
const config = withMDX(await nextConfig);
|
|
104
24
|
const resolvedRewrites = config.rewrites
|
|
105
25
|
? await config.rewrites()
|
|
106
26
|
: undefined;
|
package/dist/pages/docs.d.ts
CHANGED
|
@@ -1,7 +1,95 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import { DocsPage as FumadocsDocsPage } from "fumadocs-ui/layouts/docs/page";
|
|
2
|
+
import type { MDXComponents } from "mdx/types";
|
|
3
|
+
import type { Metadata } from "next";
|
|
4
|
+
import { type ComponentProps, type ComponentType, type ReactNode } from "react";
|
|
5
|
+
import { NativeDocsLink } from "../components/link";
|
|
6
|
+
import { type GeistdocsConfig } from "../config";
|
|
7
|
+
import { type GeistdocsPageVisibilityData } from "../page-visibility";
|
|
8
|
+
import type { GeistdocsSourceBundle } from "../source";
|
|
9
|
+
type SourceBundle = GeistdocsSourceBundle;
|
|
10
|
+
type GeistdocsPage = NonNullable<ReturnType<SourceBundle["source"]["getPage"]>>;
|
|
11
|
+
type PageActionsBundle = ReturnType<typeof createPageActions>;
|
|
12
|
+
type DocsPageLink = MDXComponents["a"];
|
|
13
|
+
type TableOfContentOptions = NonNullable<ComponentProps<typeof FumadocsDocsPage>["tableOfContent"]>;
|
|
14
|
+
export interface DocsPageParams extends Record<string, string | string[] | undefined> {
|
|
15
|
+
lang: string;
|
|
16
|
+
slug?: string[];
|
|
17
|
+
}
|
|
18
|
+
export interface DocsPageAccessContext<Params extends DocsPageParams = DocsPageParams> {
|
|
19
|
+
params: Params;
|
|
20
|
+
source: SourceBundle;
|
|
21
|
+
}
|
|
22
|
+
export type DocsPageAccessFilter<Params extends DocsPageParams = DocsPageParams> = (page: GeistdocsPage, context: DocsPageAccessContext<Params>) => boolean | Promise<boolean>;
|
|
23
|
+
type DocsPageMdx = MDXComponents | ((context: {
|
|
24
|
+
link: DocsPageLink;
|
|
25
|
+
page: GeistdocsPage;
|
|
26
|
+
source: SourceBundle;
|
|
27
|
+
}) => MDXComponents);
|
|
28
|
+
type OpenGraphImages = NonNullable<Metadata["openGraph"]>["images"];
|
|
29
|
+
interface DocsPageOpenGraphOptions {
|
|
30
|
+
images?: boolean | OpenGraphImages;
|
|
31
|
+
}
|
|
32
|
+
interface PageUrlContext<Params extends DocsPageParams = DocsPageParams> {
|
|
33
|
+
page: GeistdocsPage;
|
|
34
|
+
params: Params;
|
|
35
|
+
}
|
|
36
|
+
interface PublicPageUrlContext<Params extends DocsPageParams = DocsPageParams> extends PageUrlContext<Params> {
|
|
37
|
+
pageUrl: string;
|
|
38
|
+
}
|
|
39
|
+
interface MarkdownUrlContext<Params extends DocsPageParams = DocsPageParams> extends PublicPageUrlContext<Params> {
|
|
40
|
+
publicPageUrl: string;
|
|
41
|
+
}
|
|
42
|
+
export interface ResolvePageMarkdownUrlOptions {
|
|
43
|
+
basePath?: string;
|
|
44
|
+
isRootMountedPage?: boolean;
|
|
45
|
+
pageUrl: string;
|
|
46
|
+
publicPageUrl?: string;
|
|
47
|
+
}
|
|
48
|
+
export declare const resolvePageMarkdownUrl: (options: ResolvePageMarkdownUrlOptions) => string;
|
|
49
|
+
interface DocsPageData extends GeistdocsPageVisibilityData {
|
|
50
|
+
body: ComponentType<{
|
|
51
|
+
components?: MDXComponents;
|
|
52
|
+
}>;
|
|
53
|
+
description?: string;
|
|
54
|
+
full?: boolean;
|
|
55
|
+
title: string;
|
|
56
|
+
toc: ComponentProps<typeof FumadocsDocsPage>["toc"];
|
|
57
|
+
}
|
|
58
|
+
export interface CreateDocsPageOptions<Params extends DocsPageParams = DocsPageParams> {
|
|
59
|
+
/** Return false to make a page unavailable for the current route params. */
|
|
60
|
+
canViewPage?: DocsPageAccessFilter<Params>;
|
|
61
|
+
config: Pick<GeistdocsConfig, "ai" | "basePath" | "defaultLanguage" | "feedback" | "github" | "pageActions" | "siteId" | "singleLanguage" | "siteUrl">;
|
|
62
|
+
filterStaticParams?: (params: DocsPageParams) => boolean;
|
|
63
|
+
getMarkdownUrl?: (context: MarkdownUrlContext<Params>) => string;
|
|
64
|
+
getPageUrl?: (context: PageUrlContext<Params>) => string;
|
|
65
|
+
getPublicPageUrl?: (context: PublicPageUrlContext<Params>) => string;
|
|
66
|
+
mdx?: DocsPageMdx;
|
|
67
|
+
metadata?: (context: {
|
|
68
|
+
metadata: Metadata;
|
|
69
|
+
page: GeistdocsPage;
|
|
70
|
+
params: Params;
|
|
71
|
+
}) => Metadata | Promise<Metadata>;
|
|
72
|
+
openGraph?: DocsPageOpenGraphOptions;
|
|
73
|
+
pageActions?: PageActionsBundle;
|
|
74
|
+
renderTop?: (context: {
|
|
75
|
+
data: DocsPageData;
|
|
76
|
+
markdown: string;
|
|
77
|
+
markdownUrl: string;
|
|
78
|
+
page: GeistdocsPage;
|
|
79
|
+
pageUrl: string;
|
|
80
|
+
publicPageUrl: string;
|
|
81
|
+
}) => ReactNode;
|
|
82
|
+
resolveLink?: (context: {
|
|
83
|
+
link: DocsPageLink;
|
|
84
|
+
nativeLink: typeof NativeDocsLink;
|
|
85
|
+
page: GeistdocsPage;
|
|
86
|
+
source: SourceBundle;
|
|
87
|
+
}) => DocsPageLink;
|
|
88
|
+
source: SourceBundle;
|
|
89
|
+
tableOfContent?: TableOfContentOptions;
|
|
90
|
+
tableOfContentPopover?: ComponentProps<typeof FumadocsDocsPage>["tableOfContentPopover"];
|
|
91
|
+
}
|
|
92
|
+
export declare const createDocsPage: <Params extends DocsPageParams = DocsPageParams>({ canViewPage, config, source, mdx, pageActions, filterStaticParams, getMarkdownUrl, getPageUrl, getPublicPageUrl, metadata, openGraph, renderTop, resolveLink, tableOfContent, tableOfContentPopover, }: CreateDocsPageOptions<Params>) => {
|
|
5
93
|
Page: ({ params }: {
|
|
6
94
|
params: Promise<Params>;
|
|
7
95
|
}) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -11,6 +99,11 @@ export declare const createDocsPage: <Params extends DocsPageParams = DocsPagePa
|
|
|
11
99
|
})[];
|
|
12
100
|
generateMetadata: ({ params, }: {
|
|
13
101
|
params: Promise<Params>;
|
|
14
|
-
}) => Promise<
|
|
102
|
+
}) => Promise<Metadata>;
|
|
15
103
|
};
|
|
104
|
+
export declare const createPageActions: ({ config, getExtraActions, }: import("../internal/page-actions").CreatePageActionsOptions) => {
|
|
105
|
+
config: Pick<GeistdocsConfig, "ai" | "feedback" | "github" | "pageActions" | "siteId">;
|
|
106
|
+
getExtraActions: ((context: import("../internal/page-actions").PageActionRenderContext) => ReactNode[]) | undefined;
|
|
107
|
+
};
|
|
108
|
+
export {};
|
|
16
109
|
//# sourceMappingURL=docs.d.ts.map
|
package/dist/pages/docs.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"docs.d.ts","sourceRoot":"","sources":["../../src/pages/docs.tsx"],"names":[],"mappings":"AACA,OAAO,EACL,KAAK,
|
|
1
|
+
{"version":3,"file":"docs.d.ts","sourceRoot":"","sources":["../../src/pages/docs.tsx"],"names":[],"mappings":"AACA,OAAO,EAEL,QAAQ,IAAI,gBAAgB,EAE7B,MAAM,+BAA+B,CAAC;AACvC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAC/C,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,MAAM,CAAC;AAErC,OAAO,EACL,KAAK,cAAc,EACnB,KAAK,aAAa,EAElB,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AAEf,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAE,KAAK,eAAe,EAA+B,MAAM,WAAW,CAAC;AAgB9E,OAAO,EACL,KAAK,2BAA2B,EAEjC,MAAM,oBAAoB,CAAC;AAC5B,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,WAAW,CAAC;AAEvD,KAAK,YAAY,GAAG,qBAAqB,CAAC;AAC1C,KAAK,aAAa,GAAG,WAAW,CAAC,UAAU,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;AAChF,KAAK,iBAAiB,GAAG,UAAU,CAAC,OAAO,iBAAiB,CAAC,CAAC;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CAAC,QAAQ,CAAC;CAqDtB,CAAC;AAEF,eAAO,MAAM,iBAAiB;;;CAA4B,CAAC"}
|
package/dist/pages/docs.js
CHANGED
|
@@ -1,14 +1,251 @@
|
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import Link from "fumadocs-core/link";
|
|
3
|
+
import { DocsBody as FumadocsDocsBody, DocsPage as FumadocsDocsPage, DocsTitle as FumadocsDocsTitle, } from "fumadocs-ui/layouts/docs/page";
|
|
4
|
+
import { notFound } from "next/navigation";
|
|
5
|
+
import { cache, } from "react";
|
|
6
|
+
import { cn } from "#geistdocs-ui/utils";
|
|
7
|
+
import { NativeDocsLink } from "../components/link";
|
|
8
|
+
import { getPublicPath, withBasePath } from "../config";
|
|
9
|
+
import { getDocsLinkClassName } from "../internal/docs-link-class-name";
|
|
10
|
+
import { DocsPageErrorBoundary } from "../internal/docs-page-error-boundary";
|
|
11
|
+
import { resolveDocumentTitle } from "../internal/document-title";
|
|
12
|
+
import { omitLanguageParam, resolveRouteLanguage } from "../internal/languages";
|
|
13
|
+
import { resolveLinkHref, stripBasePathFromHref } from "../internal/link-href";
|
|
14
|
+
import { resolvePageMarkdownUrl as resolveInternalPageMarkdownUrl } from "../internal/markdown-url.js";
|
|
15
|
+
import { createPageActions as createInternalPageActions } from "../internal/page-actions";
|
|
16
|
+
import { GeistdocsPageActions } from "../internal/page-actions-gate";
|
|
17
|
+
import { PageBreadcrumb } from "../internal/page-breadcrumb";
|
|
18
|
+
import { getPageFooterItems, PageFooter } from "../internal/page-footer";
|
|
19
|
+
import { filterPageTree } from "../internal/page-tree-visibility";
|
|
20
|
+
import { createRelativeDocsLink } from "../internal/relative-docs-link";
|
|
21
|
+
import { GeistdocsTableOfContents } from "../internal/table-of-contents";
|
|
22
|
+
import { GeistdocsTableOfContentsActions } from "../internal/toc-actions-client";
|
|
1
23
|
import { createMdxComponents } from "../mdx";
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
24
|
+
import { getPageRobots, } from "../page-visibility";
|
|
25
|
+
const renderPrefetchedDocsLink = (siteUrl, basePath, { children, className, href, rel, target, ...props }) => {
|
|
26
|
+
const originalHref = String(href ?? "");
|
|
27
|
+
const resolved = resolveLinkHref(originalHref, siteUrl);
|
|
28
|
+
const linkHref = resolved.href === originalHref
|
|
29
|
+
? resolved.href
|
|
30
|
+
: stripBasePathFromHref(resolved.href, basePath);
|
|
31
|
+
return (_jsx(Link, { ...props, className: getDocsLinkClassName(className), href: linkHref, prefetch: !resolved.external, rel: resolved.external ? rel : undefined, target: resolved.external ? target : undefined, children: children }));
|
|
32
|
+
};
|
|
33
|
+
export const resolvePageMarkdownUrl = (options) => resolveInternalPageMarkdownUrl(options);
|
|
34
|
+
/**
|
|
35
|
+
* The page's visible article parts carry `data-geistdocs-article` (`title`,
|
|
36
|
+
* `body`) so tools that read the rendered HTML (docs
|
|
37
|
+
* crawlers, parity checks against the Markdown route) can select the
|
|
38
|
+
* article without depending on Fumadocs' element ids or on class names.
|
|
39
|
+
* The marked elements hold content only: page actions, breadcrumbs, the
|
|
40
|
+
* table of contents, and the previous/next footer sit outside them.
|
|
41
|
+
*/
|
|
42
|
+
const DocsTitle = ({ className, ...props }) => (_jsx(FumadocsDocsTitle, { className: cn("mb-4 text-balance", className), "data-geistdocs-article": "title", ...props }));
|
|
43
|
+
const DocsBody = ({ className, ...props }) => (_jsx(FumadocsDocsBody, { className: cn("mx-auto w-full", className), "data-geistdocs-article": "body", ...props }));
|
|
44
|
+
/** App-provided footer content below the table-of-contents actions. */
|
|
45
|
+
const TocFooterSlot = ({ children }) => children ? _jsx("div", { className: "mt-4", children: children }) : null;
|
|
46
|
+
const hasTableOfContentsActions = (config, extraActions) => config.pageActions?.scrollTop !== false ||
|
|
47
|
+
config.feedback?.enabled !== false ||
|
|
48
|
+
extraActions.length > 0;
|
|
49
|
+
const serializeParams = (params) => JSON.stringify(Object.entries(params)
|
|
50
|
+
.filter(([, value]) => value !== undefined)
|
|
51
|
+
.sort(([left], [right]) => left.localeCompare(right)));
|
|
52
|
+
export const createDocsPage = ({ canViewPage, config, source, mdx, pageActions = createInternalPageActions({ config }), filterStaticParams, getMarkdownUrl, getPageUrl, getPublicPageUrl, metadata, openGraph, renderTop, resolveLink, tableOfContent, tableOfContentPopover, }) => {
|
|
53
|
+
const DocsLink = renderPrefetchedDocsLink.bind(null, config.siteUrl, config.basePath);
|
|
54
|
+
const resolvePageUrls = (page, params) => {
|
|
55
|
+
const pageUrl = getPageUrl?.({ page, params }) ?? page.url;
|
|
56
|
+
const publicPageUrl = getPublicPageUrl?.({ page, params, pageUrl }) ??
|
|
57
|
+
getPublicPath(pageUrl, config.basePath);
|
|
58
|
+
const markdownUrl = getMarkdownUrl?.({ page, params, pageUrl, publicPageUrl }) ??
|
|
59
|
+
resolveInternalPageMarkdownUrl({
|
|
60
|
+
basePath: config.basePath,
|
|
61
|
+
isRootMountedPage: source.baseUrl === "/" && page.slugs.length === 0,
|
|
62
|
+
pageUrl,
|
|
63
|
+
publicPageUrl,
|
|
64
|
+
});
|
|
65
|
+
return { markdownUrl, pageUrl, publicPageUrl };
|
|
66
|
+
};
|
|
67
|
+
const getAccessState = cache(async (paramsKey) => {
|
|
68
|
+
const params = Object.fromEntries(JSON.parse(paramsKey));
|
|
69
|
+
const tree = source.source.getPageTree(params.lang);
|
|
70
|
+
if (!canViewPage) {
|
|
71
|
+
return { tree, visibleUrls: undefined };
|
|
72
|
+
}
|
|
73
|
+
const access = await Promise.all(source.source.getPages(params.lang).map(async (page) => ({
|
|
74
|
+
page,
|
|
75
|
+
visible: await canViewPage(page, { params, source }),
|
|
76
|
+
})));
|
|
77
|
+
const visibleUrls = new Set(access.filter(({ visible }) => visible).map(({ page }) => page.url));
|
|
78
|
+
const hiddenUrls = new Set(access.filter(({ visible }) => !visible).map(({ page }) => page.url));
|
|
79
|
+
return { tree: filterPageTree(tree, hiddenUrls), visibleUrls };
|
|
80
|
+
});
|
|
81
|
+
// Single-language apps have no [lang] segment, so params arrive without it.
|
|
82
|
+
const resolveParams = async (params) => {
|
|
83
|
+
const resolved = await params;
|
|
84
|
+
return {
|
|
85
|
+
...resolved,
|
|
86
|
+
lang: resolveRouteLanguage(config, resolved.lang),
|
|
87
|
+
};
|
|
88
|
+
};
|
|
89
|
+
const getPage = async (params) => {
|
|
90
|
+
const page = source.source.getPage(params.slug, params.lang);
|
|
91
|
+
if (!page) {
|
|
92
|
+
notFound();
|
|
93
|
+
}
|
|
94
|
+
if (canViewPage) {
|
|
95
|
+
const { visibleUrls } = await getAccessState(serializeParams(params));
|
|
96
|
+
if (!visibleUrls?.has(page.url)) {
|
|
97
|
+
notFound();
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
return page;
|
|
101
|
+
};
|
|
102
|
+
const getPageTree = async (params) => (await getAccessState(serializeParams(params))).tree;
|
|
103
|
+
const PageContent = async ({ params }) => {
|
|
104
|
+
const resolvedParams = await resolveParams(params);
|
|
105
|
+
const { lang } = resolvedParams;
|
|
106
|
+
const page = await getPage(resolvedParams);
|
|
107
|
+
const pageTree = await getPageTree(resolvedParams);
|
|
108
|
+
const data = page.data;
|
|
109
|
+
const MDX = data.body;
|
|
110
|
+
const defaultLink = createRelativeDocsLink(source.source, page, DocsLink);
|
|
111
|
+
const link = resolveLink
|
|
112
|
+
? resolveLink({
|
|
113
|
+
link: defaultLink,
|
|
114
|
+
nativeLink: NativeDocsLink,
|
|
115
|
+
page,
|
|
116
|
+
source,
|
|
117
|
+
})
|
|
118
|
+
: defaultLink;
|
|
119
|
+
const resolvedMdx = typeof mdx === "function" ? mdx({ link, page, source }) : mdx;
|
|
120
|
+
const { markdownUrl, pageUrl, publicPageUrl } = resolvePageUrls(page, resolvedParams);
|
|
121
|
+
const footerItems = getPageFooterItems(pageTree, page.url);
|
|
122
|
+
const pagesByUrl = getPageUrl
|
|
123
|
+
? new Map(source.source.getPages(lang).map((entry) => [entry.url, entry]))
|
|
124
|
+
: undefined;
|
|
125
|
+
const resolveFooterItem = (item) => {
|
|
126
|
+
if (!(item && getPageUrl && pagesByUrl)) {
|
|
127
|
+
return item;
|
|
128
|
+
}
|
|
129
|
+
const itemPage = pagesByUrl.get(item.url);
|
|
130
|
+
if (!itemPage) {
|
|
131
|
+
return item;
|
|
132
|
+
}
|
|
133
|
+
return {
|
|
134
|
+
...item,
|
|
135
|
+
url: getPageUrl({
|
|
136
|
+
page: itemPage,
|
|
137
|
+
params: { ...resolvedParams, slug: itemPage.slugs },
|
|
138
|
+
}),
|
|
139
|
+
};
|
|
140
|
+
};
|
|
141
|
+
const resolvedFooterItems = {
|
|
142
|
+
previous: resolveFooterItem(footerItems.previous),
|
|
143
|
+
next: resolveFooterItem(footerItems.next),
|
|
144
|
+
};
|
|
145
|
+
const markdown = pageActions.getExtraActions || renderTop
|
|
146
|
+
? await source.getPageMarkdown(page)
|
|
147
|
+
: undefined;
|
|
148
|
+
const footerActions = markdown
|
|
149
|
+
? (pageActions.getExtraActions?.({
|
|
150
|
+
markdown,
|
|
151
|
+
page: {
|
|
152
|
+
path: page.path,
|
|
153
|
+
url: publicPageUrl,
|
|
154
|
+
},
|
|
155
|
+
}) ?? [])
|
|
156
|
+
: [];
|
|
157
|
+
const hasTocActions = hasTableOfContentsActions(pageActions.config, footerActions);
|
|
158
|
+
const hasTocLinks = Boolean(data.toc?.length);
|
|
159
|
+
// Actions stay adjacent to the table of contents; the app-provided
|
|
160
|
+
// footer (promos and other custom content) renders below them.
|
|
161
|
+
const tocFooter = (_jsxs(_Fragment, { children: [hasTocLinks && hasTocActions ? (_jsx("div", { className: "mt-4 border-gray-alpha-400 border-t pt-4", children: _jsx("nav", { "aria-label": "Page actions", className: "flex min-w-0 flex-col gap-1", children: _jsx(GeistdocsTableOfContentsActions, { config: pageActions.config, extraActions: footerActions }) }) })) : null, _jsx(TocFooterSlot, { children: tableOfContent?.footer })] }));
|
|
162
|
+
const tocComponent = tableOfContent?.component ?? (_jsx(GeistdocsTableOfContents, { footer: tocFooter, header: tableOfContent?.header, toc: data.toc ?? [] }));
|
|
163
|
+
return (_jsxs(FumadocsDocsPage, { breadcrumb: {
|
|
164
|
+
component: _jsx(PageBreadcrumb, { tree: pageTree, url: page.url }),
|
|
165
|
+
}, footer: { component: _jsx(PageFooter, { ...resolvedFooterItems }) }, full: data.full, tableOfContent: {
|
|
166
|
+
enabled: true,
|
|
167
|
+
single: true,
|
|
168
|
+
...tableOfContent,
|
|
169
|
+
component: tocComponent,
|
|
170
|
+
}, tableOfContentPopover: {
|
|
171
|
+
enabled: false,
|
|
172
|
+
...tableOfContentPopover,
|
|
173
|
+
}, toc: data.toc, children: [renderTop?.({
|
|
174
|
+
data,
|
|
175
|
+
markdown: markdown ?? "",
|
|
176
|
+
markdownUrl,
|
|
177
|
+
page,
|
|
178
|
+
pageUrl,
|
|
179
|
+
publicPageUrl,
|
|
180
|
+
}), _jsxs("div", { className: "mb-8 flex flex-col-reverse gap-4 md:flex-row md:items-end md:justify-between", children: [_jsx(DocsTitle, { className: "mb-0 min-w-0", children: data.title }), _jsx(GeistdocsPageActions, { config: pageActions.config, only: "desktop", page: {
|
|
181
|
+
markdownUrl,
|
|
182
|
+
path: page.path,
|
|
183
|
+
title: data.title,
|
|
184
|
+
url: publicPageUrl,
|
|
185
|
+
} })] }), _jsx("div", { className: "-mt-6 mb-4 @min-[961px]:hidden", children: _jsx(GeistdocsPageActions, { config: pageActions.config, only: "mobile", page: {
|
|
186
|
+
markdownUrl,
|
|
187
|
+
path: page.path,
|
|
188
|
+
title: data.title,
|
|
189
|
+
url: publicPageUrl,
|
|
190
|
+
} }) }), _jsx(DocsBody, { children: _jsx(MDX, { components: {
|
|
191
|
+
...createMdxComponents({ a: link }),
|
|
192
|
+
...resolvedMdx,
|
|
193
|
+
} }) })] }));
|
|
194
|
+
};
|
|
195
|
+
const Page = ({ params }) => (_jsx(DocsPageErrorBoundary, { children: _jsx(PageContent, { params: params }) }));
|
|
196
|
+
const generateStaticParams = () => {
|
|
197
|
+
const params = source.source.generateParams();
|
|
198
|
+
const filtered = filterStaticParams
|
|
199
|
+
? params.filter(filterStaticParams)
|
|
200
|
+
: params;
|
|
201
|
+
return omitLanguageParam(config, filtered);
|
|
202
|
+
};
|
|
203
|
+
const generateMetadata = async ({ params, }) => {
|
|
204
|
+
const resolvedParams = await resolveParams(params);
|
|
205
|
+
const page = await getPage(resolvedParams);
|
|
206
|
+
const pageTree = await getPageTree(resolvedParams);
|
|
207
|
+
const data = page.data;
|
|
208
|
+
const { markdownUrl, publicPageUrl } = resolvePageUrls(page, resolvedParams);
|
|
209
|
+
const openGraphImages = openGraph?.images === true
|
|
210
|
+
? source.getPageImage(page).url
|
|
211
|
+
: openGraph?.images;
|
|
212
|
+
let canonicalUrl;
|
|
213
|
+
if (data.canonical) {
|
|
214
|
+
canonicalUrl = withBasePath(data.canonical, config.basePath);
|
|
215
|
+
}
|
|
216
|
+
else if (config.siteUrl) {
|
|
217
|
+
canonicalUrl = new URL(publicPageUrl, config.siteUrl).toString();
|
|
218
|
+
}
|
|
219
|
+
const defaultMetadata = {
|
|
220
|
+
title: resolveDocumentTitle({
|
|
221
|
+
pageTitle: data.title,
|
|
222
|
+
pageUrl: page.url,
|
|
223
|
+
tree: pageTree,
|
|
224
|
+
}),
|
|
225
|
+
description: data.description,
|
|
226
|
+
keywords: data.keywords,
|
|
227
|
+
robots: getPageRobots(page),
|
|
228
|
+
...(openGraphImages ? { openGraph: { images: openGraphImages } } : {}),
|
|
229
|
+
alternates: {
|
|
230
|
+
canonical: canonicalUrl,
|
|
231
|
+
types: {
|
|
232
|
+
"text/markdown": markdownUrl,
|
|
233
|
+
},
|
|
234
|
+
},
|
|
235
|
+
};
|
|
236
|
+
return metadata
|
|
237
|
+
? await metadata({
|
|
238
|
+
metadata: defaultMetadata,
|
|
239
|
+
page,
|
|
240
|
+
params: resolvedParams,
|
|
241
|
+
})
|
|
242
|
+
: defaultMetadata;
|
|
243
|
+
};
|
|
244
|
+
return {
|
|
245
|
+
Page,
|
|
246
|
+
getPageTree,
|
|
247
|
+
generateStaticParams,
|
|
248
|
+
generateMetadata,
|
|
249
|
+
};
|
|
250
|
+
};
|
|
251
|
+
export const createPageActions = createInternalPageActions;
|
package/dist/source-config.d.ts
CHANGED
|
@@ -3,15 +3,6 @@ import type { Pluggable } from "unified";
|
|
|
3
3
|
import { z } from "zod";
|
|
4
4
|
type FumadocsConfigInput = NonNullable<Parameters<typeof defineFumadocsConfig>[0]>;
|
|
5
5
|
export interface GeistdocsSourceConfigOptions {
|
|
6
|
-
/**
|
|
7
|
-
* Code block highlighter. `highlights` tokenizes with @pierre/highlights'
|
|
8
|
-
* Wasm lexers, keeping Shiki's HTML output and Fumadocs' code block
|
|
9
|
-
* transformers. `shiki` uses Shiki's TextMate grammars, for languages
|
|
10
|
-
* Highlights doesn't support or custom grammars. false disables built-in highlighting.
|
|
11
|
-
*
|
|
12
|
-
* @defaultValue "highlights"
|
|
13
|
-
*/
|
|
14
|
-
highlighter?: "shiki" | "highlights" | false;
|
|
15
6
|
mdxOptions?: DefaultMDXOptions;
|
|
16
7
|
plugins?: FumadocsConfigInput["plugins"];
|
|
17
8
|
}
|
|
@@ -90,7 +81,7 @@ export declare const geistdocsMetaSchema: z.ZodObject<{
|
|
|
90
81
|
* Fumadocs, which places it among its defaults; a function receives those
|
|
91
82
|
* defaults and returns the final list.
|
|
92
83
|
*/
|
|
93
|
-
export declare const resolveGeistdocsRehypePlugins: (consumerPlugins: DefaultMDXOptions["rehypePlugins"]
|
|
84
|
+
export declare const resolveGeistdocsRehypePlugins: (consumerPlugins: DefaultMDXOptions["rehypePlugins"]) => NonNullable<DefaultMDXOptions["rehypePlugins"]>;
|
|
94
85
|
export declare const defineGeistdocsSourceConfig: (config?: GeistdocsSourceConfigOptions) => import("fumadocs-mdx/config").GlobalConfig;
|
|
95
86
|
export {};
|
|
96
87
|
//# sourceMappingURL=source-config.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"source-config.d.ts","sourceRoot":"","sources":["../src/source-config.ts"],"names":[],"mappings":"AAMA,OAAO,EACL,KAAK,iBAAiB,EACtB,YAAY,IAAI,oBAAoB,EAGrC,MAAM,qBAAqB,CAAC;AAE7B,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AACzC,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"source-config.d.ts","sourceRoot":"","sources":["../src/source-config.ts"],"names":[],"mappings":"AAMA,OAAO,EACL,KAAK,iBAAiB,EACtB,YAAY,IAAI,oBAAoB,EAGrC,MAAM,qBAAqB,CAAC;AAE7B,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AACzC,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAKxB,KAAK,mBAAmB,GAAG,WAAW,CACpC,UAAU,CAAC,OAAO,oBAAoB,CAAC,CAAC,CAAC,CAAC,CAC3C,CAAC;AAEF,MAAM,WAAW,4BAA4B;IAC3C,UAAU,CAAC,EAAE,iBAAiB,CAAC;IAC/B,OAAO,CAAC,EAAE,mBAAmB,CAAC,SAAS,CAAC,CAAC;CAC1C;AAQD;;;;;;;GAOG;AACH,eAAO,MAAM,6BAA6B,GACxC,UAAU,SAAS,EAAE,EACrB,kBAAiB,SAAS,EAAO,KAChC,SAAS,EAgBX,CAAC;AAEF,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;CAsG3B,CAAC;AAEF,eAAO,MAAM,0BAA0B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAwCrC,CAAC;AAEH,eAAO,MAAM,mBAAmB;;;;;;;iBAAa,CAAC;AAE9C;;;;GAIG;AACH,eAAO,MAAM,6BAA6B,GACxC,iBAAiB,iBAAiB,CAAC,eAAe,CAAC,KAClD,WAAW,CAAC,iBAAiB,CAAC,eAAe,CAAC,CAKhD,CAAC;AAEF,eAAO,MAAM,2BAA2B,GACtC,SAAQ,4BAAiC,+CA2B1C,CAAC"}
|
package/dist/source-config.js
CHANGED
|
@@ -2,7 +2,6 @@ import { remarkHeading, remarkMdxMermaid, remarkSteps, remarkStructure, } from "
|
|
|
2
2
|
import { defineConfig as defineFumadocsConfig, frontmatterSchema, metaSchema, } from "fumadocs-mdx/config";
|
|
3
3
|
import lastModified from "fumadocs-mdx/plugins/last-modified";
|
|
4
4
|
import { z } from "zod";
|
|
5
|
-
import { rehypeCodeHighlights } from "../rehype-code-highlights.js";
|
|
6
5
|
import { rehypeTaskListLabels } from "../rehype-task-list-labels.js";
|
|
7
6
|
import { remarkDetails } from "../remark-details.js";
|
|
8
7
|
import { getLastModified } from "./internal/last-modified.js";
|
|
@@ -170,38 +169,28 @@ export const geistdocsMetaSchema = metaSchema;
|
|
|
170
169
|
* Fumadocs, which places it among its defaults; a function receives those
|
|
171
170
|
* defaults and returns the final list.
|
|
172
171
|
*/
|
|
173
|
-
export const resolveGeistdocsRehypePlugins = (consumerPlugins
|
|
172
|
+
export const resolveGeistdocsRehypePlugins = (consumerPlugins) => {
|
|
174
173
|
if (typeof consumerPlugins === "function") {
|
|
175
|
-
return (defaults) => [
|
|
176
|
-
...leadingPlugins,
|
|
177
|
-
...consumerPlugins(defaults),
|
|
178
|
-
rehypeTaskListLabels,
|
|
179
|
-
];
|
|
174
|
+
return (defaults) => [...consumerPlugins(defaults), rehypeTaskListLabels];
|
|
180
175
|
}
|
|
181
|
-
return [...
|
|
176
|
+
return [...(consumerPlugins ?? []), rehypeTaskListLabels];
|
|
182
177
|
};
|
|
183
178
|
export const defineGeistdocsSourceConfig = (config = {}) => {
|
|
184
179
|
const existingRemarkPlugins = Array.isArray(config.mdxOptions?.remarkPlugins)
|
|
185
180
|
? config.mdxOptions.remarkPlugins
|
|
186
181
|
: [];
|
|
187
182
|
const existingPlugins = Array.isArray(config.plugins) ? config.plugins : [];
|
|
188
|
-
const { highlighter = "highlights", ...fumadocsConfig } = config;
|
|
189
|
-
const rehypeCodeOptions = {
|
|
190
|
-
...config.mdxOptions?.rehypeCodeOptions,
|
|
191
|
-
themes: { light: geistShikiTheme },
|
|
192
|
-
defaultColor: "light",
|
|
193
|
-
};
|
|
194
|
-
// `highlights` swaps Shiki's tokenizer for @pierre/highlights; `shiki`
|
|
195
|
-
// keeps Fumadocs' rehypeCode.
|
|
196
|
-
const highlightingDisabled = highlighter === false || config.mdxOptions?.rehypeCodeOptions === false;
|
|
197
|
-
const useHighlights = highlighter === "highlights" && !highlightingDisabled;
|
|
198
183
|
return defineFumadocsConfig({
|
|
199
|
-
...
|
|
184
|
+
...config,
|
|
200
185
|
mdxOptions: {
|
|
201
186
|
...config.mdxOptions,
|
|
202
187
|
remarkPlugins: (defaults) => resolveGeistdocsRemarkPlugins(defaults, existingRemarkPlugins),
|
|
203
|
-
rehypePlugins: resolveGeistdocsRehypePlugins(config.mdxOptions?.rehypePlugins
|
|
204
|
-
rehypeCodeOptions:
|
|
188
|
+
rehypePlugins: resolveGeistdocsRehypePlugins(config.mdxOptions?.rehypePlugins),
|
|
189
|
+
rehypeCodeOptions: {
|
|
190
|
+
...config.mdxOptions?.rehypeCodeOptions,
|
|
191
|
+
themes: { light: geistShikiTheme },
|
|
192
|
+
defaultColor: "light",
|
|
193
|
+
},
|
|
205
194
|
},
|
|
206
195
|
plugins: [
|
|
207
196
|
lastModified({ versionControl: getLastModified }),
|
package/dist/source.d.ts
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type InferPageType, loader } from "fumadocs-core/source";
|
|
2
2
|
import type { PluggableList } from "unified";
|
|
3
|
-
import { type GeistdocsPageSurface } from "./config.js";
|
|
3
|
+
import { type GeistdocsConfig, type GeistdocsPageSurface } from "./config.js";
|
|
4
4
|
import { type MarkdownComponentElement, type MarkdownComponentSerializer, type MarkdownPropValue } from "./internal/mdx-to-markdown.js";
|
|
5
|
-
import { type CreateNavigationOptions } from "./internal/source-loader.js";
|
|
6
5
|
import { type GeistdocsVersionPaths } from "./internal/version-paths.js";
|
|
7
|
-
export type { FumadocsCollection, GeistdocsSlugsContext, } from "./internal/source-loader.js";
|
|
8
6
|
export type { GeistdocsVersionPaths } from "./internal/version-paths.js";
|
|
7
|
+
type LoaderOptions = Parameters<typeof loader>[0];
|
|
8
|
+
export interface FumadocsCollection {
|
|
9
|
+
toFumadocsSource(): LoaderOptions["source"];
|
|
10
|
+
}
|
|
9
11
|
export interface GeistdocsSourcePageData {
|
|
10
12
|
badge?: string;
|
|
11
13
|
canonical?: string;
|
|
@@ -60,7 +62,16 @@ export interface GeistdocsMarkdownOptions {
|
|
|
60
62
|
remarkPlugins?: PluggableList;
|
|
61
63
|
transform?: (markdown: string, context: GeistdocsMarkdownContext) => Promise<string> | string;
|
|
62
64
|
}
|
|
63
|
-
export interface
|
|
65
|
+
export interface GeistdocsSlugsContext {
|
|
66
|
+
/** Content file path relative to the content directory, including any language suffix, such as `errors/NOT_FOUND.mdx` or `guide.cn.mdx`. */
|
|
67
|
+
path: string;
|
|
68
|
+
/** Default slugs derived from the path, without folder groups or a trailing `index`. */
|
|
69
|
+
slugs: string[];
|
|
70
|
+
}
|
|
71
|
+
export interface CreateSourceOptions {
|
|
72
|
+
baseUrl?: string;
|
|
73
|
+
config: Pick<GeistdocsConfig, "agent" | "basePath" | "defaultLanguage" | "singleLanguage" | "siteUrl" | "translations"> & Partial<Pick<GeistdocsConfig, "title">>;
|
|
74
|
+
docs: FumadocsCollection;
|
|
64
75
|
id?: string;
|
|
65
76
|
label?: string;
|
|
66
77
|
markdown?: GeistdocsMarkdownOptions;
|
|
@@ -69,7 +80,7 @@ export interface CreateSourceOptions extends CreateNavigationOptions {
|
|
|
69
80
|
* slugs apply everywhere page URLs appear: routes, the page tree, Markdown
|
|
70
81
|
* routes, the sitemap, and `llms.txt`. Two pages may not share a URL.
|
|
71
82
|
*/
|
|
72
|
-
slugs?:
|
|
83
|
+
slugs?: (context: GeistdocsSlugsContext) => string[];
|
|
73
84
|
}
|
|
74
85
|
export interface GeistdocsSourceDefinition extends Omit<CreateSourceOptions, "config"> {
|
|
75
86
|
id: string;
|
package/dist/source.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"source.d.ts","sourceRoot":"","sources":["../src/source.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"source.d.ts","sourceRoot":"","sources":["../src/source.ts"],"names":[],"mappings":"AACA,OAAO,EACL,KAAK,aAAa,EAElB,MAAM,EAEP,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAC7C,OAAO,EACL,KAAK,eAAe,EACpB,KAAK,oBAAoB,EAG1B,MAAM,aAAa,CAAC;AACrB,OAAO,EAEL,KAAK,wBAAwB,EAC7B,KAAK,2BAA2B,EAChC,KAAK,iBAAiB,EACvB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EACL,KAAK,qBAAqB,EAE3B,MAAM,6BAA6B,CAAC;AAErC,YAAY,EAAE,qBAAqB,EAAE,MAAM,6BAA6B,CAAC;AAEzE,KAAK,aAAa,GAAG,UAAU,CAAC,OAAO,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;AA0FlD,MAAM,WAAW,kBAAkB;IACjC,gBAAgB,IAAI,aAAa,CAAC,QAAQ,CAAC,CAAC;CAC7C;AAED,MAAM,WAAW,uBAAuB;IACtC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,CAAC,EAAE,oBAAoB,EAAE,CAAC;IACrC,OAAO,CAAC,IAAI,EAAE,WAAW,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IAC5C,QAAQ,C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