onedocs 0.1.2 → 0.1.3
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/components/cta-section.d.ts +13 -0
- package/dist/components/cta-section.d.ts.map +1 -0
- package/dist/components/cta-section.js +4 -0
- package/dist/components/dark-mode-fix.d.ts +2 -0
- package/dist/components/dark-mode-fix.d.ts.map +1 -0
- package/dist/components/dark-mode-fix.js +9 -0
- package/dist/components/icons.d.ts +4 -0
- package/dist/components/icons.d.ts.map +1 -0
- package/dist/components/icons.js +4 -0
- package/dist/components/index.d.ts +13 -17
- package/dist/components/index.d.ts.map +1 -0
- package/dist/components/index.js +12 -53
- package/dist/components/install-block.d.ts +4 -6
- package/dist/components/install-block.d.ts.map +1 -0
- package/dist/components/install-block.js +5 -6
- package/dist/components/logo.d.ts +9 -0
- package/dist/components/logo.d.ts.map +1 -0
- package/dist/components/logo.js +4 -0
- package/dist/config.d.ts +10 -12
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +7 -6
- package/dist/index.d.ts +13 -59
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +11 -221
- package/dist/layouts/docs-page.d.ts +9 -0
- package/dist/layouts/docs-page.d.ts.map +1 -0
- package/dist/layouts/docs-page.js +6 -0
- package/dist/layouts/docs.d.ts +10 -0
- package/dist/layouts/docs.d.ts.map +1 -0
- package/dist/layouts/docs.js +6 -0
- package/dist/layouts/home.d.ts +14 -0
- package/dist/layouts/home.d.ts.map +1 -0
- package/dist/layouts/home.js +12 -0
- package/dist/layouts/root.d.ts +7 -0
- package/dist/layouts/root.d.ts.map +1 -0
- package/dist/layouts/root.js +40 -0
- package/dist/layouts/shared.d.ts +4 -0
- package/dist/layouts/shared.d.ts.map +1 -0
- package/dist/layouts/shared.js +29 -0
- package/dist/llms/index.d.ts +8 -8
- package/dist/llms/index.d.ts.map +1 -0
- package/dist/llms/index.js +87 -93
- package/dist/seo/index.d.ts +12 -0
- package/dist/seo/index.d.ts.map +1 -0
- package/dist/seo/index.js +43 -0
- package/dist/source/index.d.ts +6 -9
- package/dist/source/index.d.ts.map +1 -0
- package/dist/source/index.js +8 -8
- package/package.json +10 -6
- package/dist/chunk-EKYRMBZ6.js +0 -14
- package/dist/chunk-I3NBXJTK.js +0 -26
- package/dist/chunk-TKN3PLPZ.js +0 -37
- package/dist/chunk-WWULBBXM.js +0 -12
- package/dist/logo-BKLMVPA6.d.ts +0 -11
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"docs.d.ts","sourceRoot":"","sources":["../../src/layouts/docs.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAG/C,UAAU,eAAe;IACvB,MAAM,EAAE,aAAa,CAAC;IACtB,QAAQ,EAAE,GAAG,CAAC;IACd,QAAQ,EAAE,SAAS,CAAC;CACrB;AAED,wBAAgB,UAAU,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,EAAE,eAAe,2CAMzE"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { DocsLayout as FumaDocsLayout } from "fumadocs-ui/layouts/docs";
|
|
3
|
+
import { createBaseOptions } from "./shared";
|
|
4
|
+
export function DocsLayout({ config, pageTree, children }) {
|
|
5
|
+
return (_jsx(FumaDocsLayout, { ...createBaseOptions(config), tree: pageTree, children: children }));
|
|
6
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { OnedocsConfig } from "../config";
|
|
2
|
+
interface HomeLayoutProps {
|
|
3
|
+
config: OnedocsConfig;
|
|
4
|
+
children?: React.ReactNode;
|
|
5
|
+
}
|
|
6
|
+
export declare function HomeLayout({ config, children }: HomeLayoutProps): import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
interface HomePageProps {
|
|
8
|
+
config: OnedocsConfig;
|
|
9
|
+
packageName?: string;
|
|
10
|
+
children?: React.ReactNode;
|
|
11
|
+
}
|
|
12
|
+
export declare function HomePage({ config, packageName, children }: HomePageProps): import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
export {};
|
|
14
|
+
//# sourceMappingURL=home.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"home.d.ts","sourceRoot":"","sources":["../../src/layouts/home.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAI/C,UAAU,eAAe;IACvB,MAAM,EAAE,aAAa,CAAC;IACtB,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC5B;AAED,wBAAgB,UAAU,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,EAAE,eAAe,2CAI/D;AAED,UAAU,aAAa;IACrB,MAAM,EAAE,aAAa,CAAC;IACtB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC5B;AAED,wBAAgB,QAAQ,CAAC,EAAE,MAAM,EAAE,WAAW,EAAE,QAAQ,EAAE,EAAE,aAAa,2CAkFxE"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { HomeLayout as FumaHomeLayout } from "fumadocs-ui/layouts/home";
|
|
3
|
+
import { createBaseOptions } from "./shared";
|
|
4
|
+
import { InstallBlock } from "../components/install-block";
|
|
5
|
+
export function HomeLayout({ config, children }) {
|
|
6
|
+
return (_jsx(FumaHomeLayout, { ...createBaseOptions(config), children: children }));
|
|
7
|
+
}
|
|
8
|
+
export function HomePage({ config, packageName, children }) {
|
|
9
|
+
const { homepage } = config;
|
|
10
|
+
const currentYear = new Date().getFullYear();
|
|
11
|
+
return (_jsx(HomeLayout, { config: config, children: _jsxs("main", { className: "flex-1 flex flex-col min-h-[calc(100vh-var(--fd-nav-height))]", children: [_jsxs("div", { className: "flex-1 flex flex-col relative mx-auto w-full max-w-(--fd-layout-width)", children: [_jsx("div", { className: "absolute inset-0 border-x pointer-events-none" }), _jsxs("div", { className: "relative", children: [_jsx("section", { id: "hero", children: _jsxs("div", { className: "grid grid-cols-1 lg:grid-cols-4", children: [_jsxs("div", { className: "lg:col-span-2 p-6 lg:p-12", children: [_jsx("h1", { className: "text-left text-4xl font-semibold leading-tight text-fd-foreground sm:text-5xl md:text-6xl tracking-tight", children: homepage?.hero?.title ?? config.title }), _jsx("p", { className: "text-left max-w-xl leading-normal text-fd-muted-foreground sm:text-lg sm:leading-normal text-balance mt-4", children: homepage?.hero?.description ?? config.description }), _jsxs("div", { className: "flex flex-col sm:flex-row items-start sm:items-end gap-4 mt-8 w-full", children: [packageName && (_jsx("div", { className: "flex-1", children: _jsx(InstallBlock, { packageName: packageName }) })), _jsx("a", { href: homepage?.hero?.cta?.href ?? "/docs", className: "inline-flex h-10 items-center justify-center rounded-lg bg-fd-primary px-6 text-sm font-medium text-fd-primary-foreground shadow transition-colors hover:bg-fd-primary/90 whitespace-nowrap", children: homepage?.hero?.cta?.label ?? "Get Started" })] })] }), _jsx("div", { className: "lg:col-span-2 hidden lg:block" })] }) }), homepage?.features && homepage.features.length > 0 && (_jsx("section", { id: "features", children: _jsx("div", { className: "border-y", children: _jsx("div", { className: "grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 [&>*]:border-b [&>*:nth-last-child(-n+1)]:border-b-0 sm:[&>*:nth-last-child(-n+2)]:border-b-0 lg:[&>*:nth-last-child(-n+4)]:border-b-0", children: homepage.features.map((feature) => (_jsxs("div", { className: "flex flex-col gap-y-2 items-start justify-start py-8 px-6 transition-colors hover:bg-fd-secondary/20 sm:border-r sm:[&:nth-child(2n)]:border-r-0 lg:[&:nth-child(2n)]:border-r lg:[&:nth-child(4n)]:border-r-0", children: [feature.icon && (_jsx("div", { className: "bg-fd-primary/10 p-2 rounded-lg mb-2", children: feature.icon })), _jsx("h3", { className: "text-base font-medium text-fd-card-foreground", children: feature.title }), _jsx("p", { className: "text-sm text-fd-muted-foreground", children: feature.description })] }, feature.title))) }) }) }))] }), children && (_jsx("div", { className: "flex-1 flex items-center justify-center", children: children }))] }), _jsx("footer", { className: "relative mx-auto w-full max-w-(--fd-layout-width)", children: _jsx("div", { className: "border-x border-t px-6 py-4", children: _jsxs("p", { className: "text-sm text-fd-muted-foreground", children: ["\u00A9 ", currentYear, " ", config.title] }) }) })] }) }));
|
|
12
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"root.d.ts","sourceRoot":"","sources":["../../src/layouts/root.tsx"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAGvC,UAAU,eAAe;IACvB,QAAQ,EAAE,SAAS,CAAC;CACrB;AAED,wBAAgB,UAAU,CAAC,EAAE,QAAQ,EAAE,EAAE,eAAe,2CAWvD"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { RootProvider } from "fumadocs-ui/provider/tanstack";
|
|
3
|
+
import { FrameworkProvider } from "fumadocs-core/framework";
|
|
4
|
+
import { Link, useParams, useRouter, useRouterState, } from "@tanstack/react-router";
|
|
5
|
+
import { useMemo, useRef } from "react";
|
|
6
|
+
export function RootLayout({ children }) {
|
|
7
|
+
return (_jsx(FrameworkProvider, { Link: FrameworkLink, usePathname: usePathname, useRouter: useFrameworkRouter, useParams: useFrameworkParams, children: _jsx(RootProvider, { children: children }) }));
|
|
8
|
+
}
|
|
9
|
+
function FrameworkLink({ href, prefetch = true, ...props }) {
|
|
10
|
+
return (_jsx(Link, { to: href ?? "#", preload: prefetch ? "intent" : false, ...props, children: props.children }));
|
|
11
|
+
}
|
|
12
|
+
function usePathname() {
|
|
13
|
+
const { isLoading, pathname } = useRouterState({
|
|
14
|
+
select: (state) => ({
|
|
15
|
+
isLoading: state.isLoading,
|
|
16
|
+
pathname: state.location.pathname,
|
|
17
|
+
}),
|
|
18
|
+
});
|
|
19
|
+
const activePathname = useRef(pathname);
|
|
20
|
+
return useMemo(() => {
|
|
21
|
+
if (isLoading)
|
|
22
|
+
return activePathname.current;
|
|
23
|
+
activePathname.current = pathname;
|
|
24
|
+
return pathname;
|
|
25
|
+
}, [isLoading, pathname]);
|
|
26
|
+
}
|
|
27
|
+
function useFrameworkRouter() {
|
|
28
|
+
const router = useRouter();
|
|
29
|
+
return useMemo(() => ({
|
|
30
|
+
push(url) {
|
|
31
|
+
router.navigate({ href: url });
|
|
32
|
+
},
|
|
33
|
+
refresh() {
|
|
34
|
+
router.invalidate();
|
|
35
|
+
},
|
|
36
|
+
}), [router]);
|
|
37
|
+
}
|
|
38
|
+
function useFrameworkParams() {
|
|
39
|
+
return useParams({ strict: false });
|
|
40
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shared.d.ts","sourceRoot":"","sources":["../../src/layouts/shared.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAgB,MAAM,4BAA4B,CAAC;AAChF,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAI/C,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,aAAa,GAAG,eAAe,CA4BxE"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Logo } from "../components/logo";
|
|
3
|
+
import { GitHubIcon } from "../components/icons";
|
|
4
|
+
export function createBaseOptions(config) {
|
|
5
|
+
const links = (config.nav?.links ?? []).map((link) => ({
|
|
6
|
+
type: "main",
|
|
7
|
+
text: link.label,
|
|
8
|
+
url: link.href,
|
|
9
|
+
}));
|
|
10
|
+
if (config.nav?.github) {
|
|
11
|
+
links.push({
|
|
12
|
+
type: "icon",
|
|
13
|
+
text: "GitHub",
|
|
14
|
+
icon: _jsx(GitHubIcon, {}),
|
|
15
|
+
url: `https://github.com/${config.nav.github}`,
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
const navTitle = config.logo
|
|
19
|
+
? typeof config.logo === "string"
|
|
20
|
+
? _jsx("img", { src: config.logo, alt: config.title, className: "h-6" })
|
|
21
|
+
: _jsx(Logo, { light: config.logo.light, dark: config.logo.dark, alt: config.title, className: "h-6" })
|
|
22
|
+
: config.title;
|
|
23
|
+
return {
|
|
24
|
+
nav: {
|
|
25
|
+
title: navTitle,
|
|
26
|
+
},
|
|
27
|
+
links,
|
|
28
|
+
};
|
|
29
|
+
}
|
package/dist/llms/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
interface LLMsConfig {
|
|
1
|
+
export interface LLMsConfig {
|
|
2
2
|
title: string;
|
|
3
3
|
description?: string;
|
|
4
4
|
}
|
|
@@ -15,7 +15,7 @@ interface Page {
|
|
|
15
15
|
getText?: (type: string) => Promise<string>;
|
|
16
16
|
};
|
|
17
17
|
}
|
|
18
|
-
interface LLMsSource {
|
|
18
|
+
export interface LLMsSource {
|
|
19
19
|
getPages: () => Page[];
|
|
20
20
|
}
|
|
21
21
|
type FumadocsPageData = {
|
|
@@ -29,7 +29,7 @@ type FumadocsPage = {
|
|
|
29
29
|
slugs: string[];
|
|
30
30
|
data: FumadocsPageData;
|
|
31
31
|
};
|
|
32
|
-
declare function createLLMsSource(source: {
|
|
32
|
+
export declare function createLLMsSource(source: {
|
|
33
33
|
getPages: () => FumadocsPage[];
|
|
34
34
|
}): {
|
|
35
35
|
getPages: () => {
|
|
@@ -46,12 +46,12 @@ declare function createLLMsSource(source: {
|
|
|
46
46
|
};
|
|
47
47
|
}[];
|
|
48
48
|
};
|
|
49
|
-
declare function getLLMText(page: Page): Promise<string>;
|
|
50
|
-
declare function createLLMsHandler(source: LLMsSource, config: LLMsConfig): {
|
|
49
|
+
export declare function getLLMText(page: Page): Promise<string>;
|
|
50
|
+
export declare function createLLMsHandler(source: LLMsSource, config: LLMsConfig): {
|
|
51
51
|
GET: () => Promise<Response>;
|
|
52
52
|
};
|
|
53
|
-
declare function createLLMsFullHandler(source: LLMsSource): {
|
|
53
|
+
export declare function createLLMsFullHandler(source: LLMsSource): {
|
|
54
54
|
GET: () => Promise<Response>;
|
|
55
55
|
};
|
|
56
|
-
|
|
57
|
-
|
|
56
|
+
export {};
|
|
57
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/llms/index.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,UAAU;IACzB,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,UAAU,IAAI;IACZ,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE;QACJ,KAAK,EAAE,MAAM,CAAC;QACd,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,IAAI,CAAC,EAAE,MAAM,OAAO,CAAC;YAAE,cAAc,CAAC,EAAE;gBAAE,OAAO,CAAC,EAAE,MAAM,CAAA;aAAE,CAAA;SAAE,CAAC,CAAC;QAChE,OAAO,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;KAC7C,CAAC;CACH;AAED,MAAM,WAAW,UAAU;IACzB,QAAQ,EAAE,MAAM,IAAI,EAAE,CAAC;CACxB;AAED,KAAK,gBAAgB,GAAG;IACtB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,OAAO,CAAC,EAAE,CAAC,IAAI,EAAE,KAAK,GAAG,WAAW,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;IACzD,IAAI,CAAC,EAAE,MAAM,OAAO,CAAC,OAAO,CAAC,CAAC;CAC/B,CAAC;AAEF,KAAK,YAAY,GAAG;IAClB,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,IAAI,EAAE,gBAAgB,CAAC;CACxB,CAAC;AA4BF,wBAAgB,gBAAgB,CAAC,MAAM,EAAE;IAAE,QAAQ,EAAE,MAAM,YAAY,EAAE,CAAA;CAAE;;;;mBAlDhE,MAAM;0BACC,MAAM;mBACb,MAAM,OAAO,CAAC;gBAAE,cAAc,CAAC,EAAE;oBAAE,OAAO,CAAC,EAAE,MAAM,CAAA;iBAAE,CAAA;aAAE,CAAC;sBACrD,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,CAAC;;;EA0D9C;AAED,wBAAsB,UAAU,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO,CAAC,MAAM,CAAC,CAoB5D;AAWD,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,UAAU;;EAgCvE;AAED,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,UAAU;;EAavD"}
|
package/dist/llms/index.js
CHANGED
|
@@ -1,105 +1,99 @@
|
|
|
1
|
-
// src/llms/index.ts
|
|
2
1
|
function toLLMPageData(data, fallbackTitle) {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
2
|
+
const getText = data.getText;
|
|
3
|
+
const load = data.load
|
|
4
|
+
? async () => {
|
|
5
|
+
const loaded = await data.load?.();
|
|
6
|
+
const structuredData = typeof loaded === "object" && loaded !== null
|
|
7
|
+
? loaded.structuredData
|
|
8
|
+
: undefined;
|
|
9
|
+
return structuredData ? { structuredData } : {};
|
|
10
|
+
}
|
|
11
|
+
: undefined;
|
|
12
|
+
return {
|
|
13
|
+
title: data.title ?? fallbackTitle,
|
|
14
|
+
description: data.description,
|
|
15
|
+
getText: getText
|
|
16
|
+
? (type) => getText(type)
|
|
17
|
+
: undefined,
|
|
18
|
+
load,
|
|
19
|
+
};
|
|
15
20
|
}
|
|
16
|
-
function createLLMsSource(source) {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
)
|
|
24
|
-
}))
|
|
25
|
-
};
|
|
21
|
+
export function createLLMsSource(source) {
|
|
22
|
+
return {
|
|
23
|
+
getPages: () => source.getPages().map((page) => ({
|
|
24
|
+
url: page.url,
|
|
25
|
+
data: toLLMPageData(page.data, page.slugs[page.slugs.length - 1] ?? page.url),
|
|
26
|
+
})),
|
|
27
|
+
};
|
|
26
28
|
}
|
|
27
|
-
async function getLLMText(page) {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
29
|
+
export async function getLLMText(page) {
|
|
30
|
+
let text = "";
|
|
31
|
+
if (page.data.getText) {
|
|
32
|
+
try {
|
|
33
|
+
text = await page.data.getText("processed");
|
|
34
|
+
}
|
|
35
|
+
catch { }
|
|
33
36
|
}
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
37
|
+
if (!text && page.data.load) {
|
|
38
|
+
try {
|
|
39
|
+
const content = await page.data.load();
|
|
40
|
+
text = content?.structuredData?.content || "";
|
|
41
|
+
}
|
|
42
|
+
catch { }
|
|
40
43
|
}
|
|
41
|
-
|
|
42
|
-
return `# ${page.data.title}
|
|
44
|
+
return `# ${page.data.title}
|
|
43
45
|
URL: ${page.url}
|
|
44
|
-
${page.data.description ? `
|
|
45
|
-
${page.data.description}
|
|
46
|
-
` : ""}
|
|
46
|
+
${page.data.description ? `\n${page.data.description}\n` : ""}
|
|
47
47
|
${text}`;
|
|
48
48
|
}
|
|
49
49
|
function sortPages(pages) {
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
50
|
+
return [...pages].sort((a, b) => {
|
|
51
|
+
const aDepth = a.url.split("/").length;
|
|
52
|
+
const bDepth = b.url.split("/").length;
|
|
53
|
+
if (aDepth !== bDepth)
|
|
54
|
+
return aDepth - bDepth;
|
|
55
|
+
return a.url.localeCompare(b.url);
|
|
56
|
+
});
|
|
56
57
|
}
|
|
57
|
-
function createLLMsHandler(source, config) {
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
}
|
|
85
|
-
};
|
|
58
|
+
export function createLLMsHandler(source, config) {
|
|
59
|
+
return {
|
|
60
|
+
GET: async () => {
|
|
61
|
+
const pages = sortPages(source.getPages());
|
|
62
|
+
const lines = [
|
|
63
|
+
`# ${config.title}`,
|
|
64
|
+
"",
|
|
65
|
+
config.description ? `${config.description}\n` : "",
|
|
66
|
+
"## Pages",
|
|
67
|
+
"",
|
|
68
|
+
];
|
|
69
|
+
for (const page of pages) {
|
|
70
|
+
lines.push(`- ${page.data.title}: ${page.url}`);
|
|
71
|
+
if (page.data.description) {
|
|
72
|
+
lines.push(` ${page.data.description}`);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
lines.push("");
|
|
76
|
+
lines.push("## Full Content");
|
|
77
|
+
lines.push("");
|
|
78
|
+
lines.push("For full documentation content, see /llms-full.txt");
|
|
79
|
+
return new Response(lines.join("\n"), {
|
|
80
|
+
headers: {
|
|
81
|
+
"Content-Type": "text/plain; charset=utf-8",
|
|
82
|
+
},
|
|
83
|
+
});
|
|
84
|
+
},
|
|
85
|
+
};
|
|
86
86
|
}
|
|
87
|
-
function createLLMsFullHandler(source) {
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
87
|
+
export function createLLMsFullHandler(source) {
|
|
88
|
+
return {
|
|
89
|
+
GET: async () => {
|
|
90
|
+
const pages = sortPages(source.getPages());
|
|
91
|
+
const contents = await Promise.all(pages.map(getLLMText));
|
|
92
|
+
return new Response(contents.join("\n\n---\n\n"), {
|
|
93
|
+
headers: {
|
|
94
|
+
"Content-Type": "text/plain; charset=utf-8",
|
|
95
|
+
},
|
|
96
|
+
});
|
|
97
|
+
},
|
|
98
|
+
};
|
|
99
99
|
}
|
|
100
|
-
export {
|
|
101
|
-
createLLMsFullHandler,
|
|
102
|
-
createLLMsHandler,
|
|
103
|
-
createLLMsSource,
|
|
104
|
-
getLLMText
|
|
105
|
-
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export interface RobotsConfig {
|
|
2
|
+
baseUrl: string;
|
|
3
|
+
sitemapPath?: string;
|
|
4
|
+
}
|
|
5
|
+
export interface DocsSitemapConfig {
|
|
6
|
+
baseUrl: string;
|
|
7
|
+
pages: string[];
|
|
8
|
+
docsPath?: string;
|
|
9
|
+
}
|
|
10
|
+
export declare function createRobotsHandler({ baseUrl, sitemapPath, }: RobotsConfig): () => Response;
|
|
11
|
+
export declare function createDocsSitemapHandler({ baseUrl, pages, docsPath, }: DocsSitemapConfig): () => Response;
|
|
12
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/seo/index.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,YAAY;IAC3B,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,iBAAiB;IAChC,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAUD,wBAAgB,mBAAmB,CAAC,EAClC,OAAO,EACP,WAA4B,GAC7B,EAAE,YAAY,kBAad;AAED,wBAAgB,wBAAwB,CAAC,EACvC,OAAO,EACP,KAAK,EACL,QAAkB,GACnB,EAAE,iBAAiB,kBA8BnB"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
const normalizeBaseUrl = (baseUrl) => baseUrl.replace(/\/+$/, "");
|
|
2
|
+
const normalizeDocsPath = (docsPath) => {
|
|
3
|
+
const trimmed = docsPath.replace(/\/+$/, "");
|
|
4
|
+
if (!trimmed || trimmed === "/")
|
|
5
|
+
return "";
|
|
6
|
+
return trimmed.startsWith("/") ? trimmed : `/${trimmed}`;
|
|
7
|
+
};
|
|
8
|
+
export function createRobotsHandler({ baseUrl, sitemapPath = "/sitemap.xml", }) {
|
|
9
|
+
const siteUrl = normalizeBaseUrl(baseUrl);
|
|
10
|
+
const sitemapUrl = sitemapPath.startsWith("/")
|
|
11
|
+
? `${siteUrl}${sitemapPath}`
|
|
12
|
+
: `${siteUrl}/${sitemapPath}`;
|
|
13
|
+
const body = `User-agent: *\nAllow: /\nSitemap: ${sitemapUrl}\nHost: ${siteUrl}\n`;
|
|
14
|
+
return () => new Response(body, {
|
|
15
|
+
headers: {
|
|
16
|
+
"content-type": "text/plain; charset=utf-8",
|
|
17
|
+
},
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
export function createDocsSitemapHandler({ baseUrl, pages, docsPath = "/docs", }) {
|
|
21
|
+
const siteUrl = normalizeBaseUrl(baseUrl);
|
|
22
|
+
const docsBase = normalizeDocsPath(docsPath);
|
|
23
|
+
const urls = [siteUrl];
|
|
24
|
+
for (const page of pages) {
|
|
25
|
+
if (page.startsWith("---"))
|
|
26
|
+
continue;
|
|
27
|
+
if (page.startsWith("index")) {
|
|
28
|
+
urls.push(`${siteUrl}${docsBase}/`);
|
|
29
|
+
continue;
|
|
30
|
+
}
|
|
31
|
+
urls.push(`${siteUrl}${docsBase}/${page}/`);
|
|
32
|
+
}
|
|
33
|
+
const now = new Date().toISOString();
|
|
34
|
+
const entries = urls
|
|
35
|
+
.map((url) => ` <url>\n <loc>${url}</loc>\n <lastmod>${now}</lastmod>\n </url>`)
|
|
36
|
+
.join("\n");
|
|
37
|
+
const sitemap = `<?xml version="1.0" encoding="UTF-8"?>\n<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">\n${entries}\n</urlset>`;
|
|
38
|
+
return () => new Response(sitemap, {
|
|
39
|
+
headers: {
|
|
40
|
+
"content-type": "application/xml; charset=utf-8",
|
|
41
|
+
},
|
|
42
|
+
});
|
|
43
|
+
}
|
package/dist/source/index.d.ts
CHANGED
|
@@ -1,14 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
export { loader } from 'fumadocs-core/source';
|
|
3
|
-
|
|
4
|
-
interface CreateSourceOptions {
|
|
1
|
+
export interface CreateSourceOptions {
|
|
5
2
|
baseUrl?: string;
|
|
6
3
|
}
|
|
7
|
-
declare function createSource(docsSource: {
|
|
4
|
+
export declare function createSource(docsSource: {
|
|
8
5
|
toFumadocsSource: () => any;
|
|
9
|
-
}, options?: CreateSourceOptions):
|
|
10
|
-
source:
|
|
6
|
+
}, options?: CreateSourceOptions): import("fumadocs-core/source").LoaderOutput<{
|
|
7
|
+
source: import("fumadocs-core/source").SourceConfig;
|
|
11
8
|
i18n: undefined;
|
|
12
9
|
}>;
|
|
13
|
-
|
|
14
|
-
|
|
10
|
+
export { loader } from "fumadocs-core/source";
|
|
11
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/source/index.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,mBAAmB;IAClC,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,wBAAgB,YAAY,CAC1B,UAAU,EAAE;IAAE,gBAAgB,EAAE,MAAM,GAAG,CAAA;CAAE,EAC3C,OAAO,GAAE,mBAAwB;;;GAMlC;AAED,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC"}
|
package/dist/source/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
};
|
|
1
|
+
import { loader } from "fumadocs-core/source";
|
|
2
|
+
export function createSource(docsSource, options = {}) {
|
|
3
|
+
return loader({
|
|
4
|
+
source: docsSource.toFumadocsSource(),
|
|
5
|
+
baseUrl: options.baseUrl ?? "/docs",
|
|
6
|
+
});
|
|
7
|
+
}
|
|
8
|
+
export { loader } from "fumadocs-core/source";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "onedocs",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.3",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Zero-config documentation for TanStack Start + Fumadocs. Install one dependency, write markdown, ship docs.",
|
|
6
6
|
"license": "MIT",
|
|
@@ -45,6 +45,10 @@
|
|
|
45
45
|
"types": "./dist/llms/index.d.ts",
|
|
46
46
|
"import": "./dist/llms/index.js"
|
|
47
47
|
},
|
|
48
|
+
"./seo": {
|
|
49
|
+
"types": "./dist/seo/index.d.ts",
|
|
50
|
+
"import": "./dist/seo/index.js"
|
|
51
|
+
},
|
|
48
52
|
"./css/preset.css": "./src/css/preset.css"
|
|
49
53
|
},
|
|
50
54
|
"files": [
|
|
@@ -61,8 +65,9 @@
|
|
|
61
65
|
"node": ">=18"
|
|
62
66
|
},
|
|
63
67
|
"scripts": {
|
|
64
|
-
"
|
|
65
|
-
"
|
|
68
|
+
"clean": "rm -rf dist",
|
|
69
|
+
"build": "bun run clean && tsc -p tsconfig.json",
|
|
70
|
+
"dev": "tsc -w -p tsconfig.json",
|
|
66
71
|
"test": "bun test",
|
|
67
72
|
"prepack": "bun run build"
|
|
68
73
|
},
|
|
@@ -70,7 +75,7 @@
|
|
|
70
75
|
"@tanstack/react-router": "^1.0.0",
|
|
71
76
|
"@tanstack/start": "^1.0.0",
|
|
72
77
|
"fumadocs-core": "^16.4.7",
|
|
73
|
-
"fumadocs-mdx": "^14.2.
|
|
78
|
+
"fumadocs-mdx": "^14.2.6",
|
|
74
79
|
"fumadocs-ui": "^16.4.7",
|
|
75
80
|
"lucide-react": "^0.562.0",
|
|
76
81
|
"react": "^18.0.0 || ^19.0.0",
|
|
@@ -83,11 +88,10 @@
|
|
|
83
88
|
"@types/react": "^19.2.8",
|
|
84
89
|
"@types/react-dom": "^19.2.3",
|
|
85
90
|
"fumadocs-core": "^16.4.7",
|
|
86
|
-
"fumadocs-mdx": "^14.2.
|
|
91
|
+
"fumadocs-mdx": "^14.2.6",
|
|
87
92
|
"fumadocs-ui": "^16.4.7",
|
|
88
93
|
"jsdom": "^27.4.0",
|
|
89
94
|
"lucide-react": "^0.562.0",
|
|
90
|
-
"tsup": "^8.5.1",
|
|
91
95
|
"typescript": "^5.9.3"
|
|
92
96
|
}
|
|
93
97
|
}
|
package/dist/chunk-EKYRMBZ6.js
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
// src/source/index.ts
|
|
2
|
-
import { loader } from "fumadocs-core/source";
|
|
3
|
-
import { loader as loader2 } from "fumadocs-core/source";
|
|
4
|
-
function createSource(docsSource, options = {}) {
|
|
5
|
-
return loader({
|
|
6
|
-
source: docsSource.toFumadocsSource(),
|
|
7
|
-
baseUrl: options.baseUrl ?? "/docs"
|
|
8
|
-
});
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
export {
|
|
12
|
-
createSource,
|
|
13
|
-
loader2 as loader
|
|
14
|
-
};
|
package/dist/chunk-I3NBXJTK.js
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
// src/components/logo.tsx
|
|
2
|
-
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
-
function Logo({ light, dark, alt = "Logo", className }) {
|
|
4
|
-
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
5
|
-
/* @__PURE__ */ jsx(
|
|
6
|
-
"img",
|
|
7
|
-
{
|
|
8
|
-
src: light,
|
|
9
|
-
alt,
|
|
10
|
-
className: `dark:hidden ${className ?? ""}`
|
|
11
|
-
}
|
|
12
|
-
),
|
|
13
|
-
/* @__PURE__ */ jsx(
|
|
14
|
-
"img",
|
|
15
|
-
{
|
|
16
|
-
src: dark,
|
|
17
|
-
alt,
|
|
18
|
-
className: `hidden dark:block ${className ?? ""}`
|
|
19
|
-
}
|
|
20
|
-
)
|
|
21
|
-
] });
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
export {
|
|
25
|
-
Logo
|
|
26
|
-
};
|
package/dist/chunk-TKN3PLPZ.js
DELETED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
// src/components/install-block.tsx
|
|
2
|
-
import { Tabs, Tab } from "fumadocs-ui/components/tabs";
|
|
3
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
|
-
function InstallBlock({
|
|
5
|
-
title,
|
|
6
|
-
description,
|
|
7
|
-
packageName,
|
|
8
|
-
children
|
|
9
|
-
}) {
|
|
10
|
-
return /* @__PURE__ */ jsxs("div", { children: [
|
|
11
|
-
title && /* @__PURE__ */ jsx("h1", { className: "mb-4 text-4xl font-bold tracking-tight md:text-5xl lg:text-6xl", children: title }),
|
|
12
|
-
description && /* @__PURE__ */ jsx("p", { className: "text-fd-muted-foreground mb-6 text-balance", children: description }),
|
|
13
|
-
/* @__PURE__ */ jsxs(Tabs, { groupId: "pm", items: ["npm", "yarn", "pnpm", "bun"], className: "!mb-0", children: [
|
|
14
|
-
/* @__PURE__ */ jsx(Tab, { value: "npm", children: /* @__PURE__ */ jsxs("code", { className: "block rounded bg-fd-secondary px-3 py-2 text-sm", children: [
|
|
15
|
-
"npm i ",
|
|
16
|
-
packageName
|
|
17
|
-
] }) }),
|
|
18
|
-
/* @__PURE__ */ jsx(Tab, { value: "yarn", children: /* @__PURE__ */ jsxs("code", { className: "block rounded bg-fd-secondary px-3 py-2 text-sm", children: [
|
|
19
|
-
"yarn add ",
|
|
20
|
-
packageName
|
|
21
|
-
] }) }),
|
|
22
|
-
/* @__PURE__ */ jsx(Tab, { value: "pnpm", children: /* @__PURE__ */ jsxs("code", { className: "block rounded bg-fd-secondary px-3 py-2 text-sm", children: [
|
|
23
|
-
"pnpm add ",
|
|
24
|
-
packageName
|
|
25
|
-
] }) }),
|
|
26
|
-
/* @__PURE__ */ jsx(Tab, { value: "bun", children: /* @__PURE__ */ jsxs("code", { className: "block rounded bg-fd-secondary px-3 py-2 text-sm", children: [
|
|
27
|
-
"bun add ",
|
|
28
|
-
packageName
|
|
29
|
-
] }) })
|
|
30
|
-
] }),
|
|
31
|
-
children && /* @__PURE__ */ jsx("div", { className: "mt-6", children })
|
|
32
|
-
] });
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
export {
|
|
36
|
-
InstallBlock
|
|
37
|
-
};
|
package/dist/chunk-WWULBBXM.js
DELETED
package/dist/logo-BKLMVPA6.d.ts
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
|
|
3
|
-
interface LogoProps {
|
|
4
|
-
light: string;
|
|
5
|
-
dark: string;
|
|
6
|
-
alt?: string;
|
|
7
|
-
className?: string;
|
|
8
|
-
}
|
|
9
|
-
declare function Logo({ light, dark, alt, className }: LogoProps): react_jsx_runtime.JSX.Element;
|
|
10
|
-
|
|
11
|
-
export { Logo as L };
|