fumadocs-core 15.1.3 → 15.2.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.
- package/dist/chunk-FVY6EZ3N.js +94 -0
- package/dist/{chunk-DVOZJZGH.js → chunk-NNKVN7WA.js} +8 -15
- package/dist/dynamic-link.d.ts +0 -1
- package/dist/dynamic-link.js +4 -2
- package/dist/framework/index.d.ts +48 -0
- package/dist/framework/index.js +20 -0
- package/dist/framework/next.d.ts +8 -0
- package/dist/framework/next.js +27 -0
- package/dist/framework/react-router.d.ts +8 -0
- package/dist/framework/react-router.js +47 -0
- package/dist/framework/tanstack.d.ts +11 -0
- package/dist/framework/tanstack.js +47 -0
- package/dist/highlight/client.js +96 -3
- package/dist/highlight/index.js +0 -1
- package/dist/link.d.ts +5 -5
- package/dist/link.js +3 -1
- package/dist/mdx-plugins/index.js +2 -0
- package/dist/server/index.d.ts +0 -4
- package/dist/server/index.js +4 -9
- package/dist/source/index.js +1 -0
- package/package.json +21 -31
- package/dist/chunk-62S4EN7J.js +0 -101
- package/dist/chunk-WQMD6AUR.js +0 -0
- package/dist/utils/use-shiki.d.ts +0 -6
- package/dist/utils/use-shiki.js +0 -8
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
// src/framework/index.tsx
|
|
2
|
+
import React from "react";
|
|
3
|
+
import { jsx } from "react/jsx-runtime";
|
|
4
|
+
var notImplemented = () => {
|
|
5
|
+
throw new Error(
|
|
6
|
+
"You need to wrap your application inside `FrameworkProvider`."
|
|
7
|
+
);
|
|
8
|
+
};
|
|
9
|
+
var FrameworkContext = createContext("FrameworkContext", {
|
|
10
|
+
useParams: notImplemented,
|
|
11
|
+
useRouter: notImplemented,
|
|
12
|
+
usePathname: notImplemented
|
|
13
|
+
});
|
|
14
|
+
function FrameworkProvider({
|
|
15
|
+
children,
|
|
16
|
+
...props
|
|
17
|
+
}) {
|
|
18
|
+
const framework = React.useMemo(
|
|
19
|
+
() => ({
|
|
20
|
+
usePathname: props.usePathname,
|
|
21
|
+
useRouter: props.useRouter,
|
|
22
|
+
Link: props.Link,
|
|
23
|
+
Image: props.Image,
|
|
24
|
+
useParams: props.useParams
|
|
25
|
+
}),
|
|
26
|
+
[
|
|
27
|
+
props.Link,
|
|
28
|
+
props.usePathname,
|
|
29
|
+
props.useRouter,
|
|
30
|
+
props.useParams,
|
|
31
|
+
props.Image
|
|
32
|
+
]
|
|
33
|
+
);
|
|
34
|
+
return /* @__PURE__ */ jsx(FrameworkContext.Provider, { value: framework, children });
|
|
35
|
+
}
|
|
36
|
+
function usePathname() {
|
|
37
|
+
return FrameworkContext.use().usePathname();
|
|
38
|
+
}
|
|
39
|
+
function useRouter() {
|
|
40
|
+
return FrameworkContext.use().useRouter();
|
|
41
|
+
}
|
|
42
|
+
function useParams() {
|
|
43
|
+
return FrameworkContext.use().useParams();
|
|
44
|
+
}
|
|
45
|
+
function Image(props) {
|
|
46
|
+
const { Image: Image2 } = FrameworkContext.use();
|
|
47
|
+
if (!Image2) {
|
|
48
|
+
const { src, alt, priority, ...rest } = props;
|
|
49
|
+
return /* @__PURE__ */ jsx(
|
|
50
|
+
"img",
|
|
51
|
+
{
|
|
52
|
+
alt,
|
|
53
|
+
src,
|
|
54
|
+
fetchPriority: priority ? "high" : "auto",
|
|
55
|
+
...rest
|
|
56
|
+
}
|
|
57
|
+
);
|
|
58
|
+
}
|
|
59
|
+
return /* @__PURE__ */ jsx(Image2, { ...props });
|
|
60
|
+
}
|
|
61
|
+
function Link(props) {
|
|
62
|
+
const { Link: Link2 } = FrameworkContext.use();
|
|
63
|
+
if (!Link2) {
|
|
64
|
+
const { href, prefetch: _, ...rest } = props;
|
|
65
|
+
return /* @__PURE__ */ jsx("a", { href, ...rest });
|
|
66
|
+
}
|
|
67
|
+
return /* @__PURE__ */ jsx(Link2, { ...props });
|
|
68
|
+
}
|
|
69
|
+
function createContext(name, v) {
|
|
70
|
+
const Context = React.createContext(v);
|
|
71
|
+
return {
|
|
72
|
+
Provider: (props) => {
|
|
73
|
+
return /* @__PURE__ */ jsx(Context.Provider, { value: props.value, children: props.children });
|
|
74
|
+
},
|
|
75
|
+
use: (errorMessage) => {
|
|
76
|
+
const value = React.useContext(Context);
|
|
77
|
+
if (!value)
|
|
78
|
+
throw new Error(
|
|
79
|
+
errorMessage ?? `Provider of ${name} is required but missing.`
|
|
80
|
+
);
|
|
81
|
+
return value;
|
|
82
|
+
}
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
export {
|
|
87
|
+
FrameworkProvider,
|
|
88
|
+
usePathname,
|
|
89
|
+
useRouter,
|
|
90
|
+
useParams,
|
|
91
|
+
Image,
|
|
92
|
+
Link,
|
|
93
|
+
createContext
|
|
94
|
+
};
|
|
@@ -1,13 +1,15 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Link
|
|
3
|
+
} from "./chunk-FVY6EZ3N.js";
|
|
4
|
+
|
|
1
5
|
// src/link.tsx
|
|
2
|
-
import Original from "next/link";
|
|
3
6
|
import { forwardRef } from "react";
|
|
4
7
|
import { jsx } from "react/jsx-runtime";
|
|
5
|
-
var
|
|
8
|
+
var Link2 = forwardRef(
|
|
6
9
|
({
|
|
7
10
|
href = "#",
|
|
8
11
|
external = !(href.startsWith("/") || href.startsWith("#") || href.startsWith(".")),
|
|
9
12
|
prefetch,
|
|
10
|
-
replace,
|
|
11
13
|
...props
|
|
12
14
|
}, ref) => {
|
|
13
15
|
if (external) {
|
|
@@ -23,20 +25,11 @@ var Link = forwardRef(
|
|
|
23
25
|
}
|
|
24
26
|
);
|
|
25
27
|
}
|
|
26
|
-
return /* @__PURE__ */ jsx(
|
|
27
|
-
Original,
|
|
28
|
-
{
|
|
29
|
-
ref,
|
|
30
|
-
href,
|
|
31
|
-
prefetch,
|
|
32
|
-
replace,
|
|
33
|
-
...props
|
|
34
|
-
}
|
|
35
|
-
);
|
|
28
|
+
return /* @__PURE__ */ jsx(Link, { ref, href, prefetch, ...props });
|
|
36
29
|
}
|
|
37
30
|
);
|
|
38
|
-
|
|
31
|
+
Link2.displayName = "Link";
|
|
39
32
|
|
|
40
33
|
export {
|
|
41
|
-
Link
|
|
34
|
+
Link2 as Link
|
|
42
35
|
};
|
package/dist/dynamic-link.d.ts
CHANGED
package/dist/dynamic-link.js
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import {
|
|
3
3
|
Link
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-NNKVN7WA.js";
|
|
5
|
+
import {
|
|
6
|
+
useParams
|
|
7
|
+
} from "./chunk-FVY6EZ3N.js";
|
|
5
8
|
import "./chunk-MLKGABMK.js";
|
|
6
9
|
|
|
7
10
|
// src/dynamic-link.tsx
|
|
8
|
-
import { useParams } from "next/navigation";
|
|
9
11
|
import { forwardRef, useMemo } from "react";
|
|
10
12
|
import { jsx } from "react/jsx-runtime";
|
|
11
13
|
var DynamicLink = forwardRef(
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { ComponentProps, FC, ReactNode } from 'react';
|
|
3
|
+
import { StaticImport } from 'next/dist/shared/lib/get-img-props';
|
|
4
|
+
|
|
5
|
+
interface ImageProps extends Omit<ComponentProps<'img'>, 'src'> {
|
|
6
|
+
sizes?: string;
|
|
7
|
+
/**
|
|
8
|
+
* Next.js Image component has other allowed type for `src`
|
|
9
|
+
*/
|
|
10
|
+
src?: string | StaticImport;
|
|
11
|
+
/**
|
|
12
|
+
* priority of image (from Next.js)
|
|
13
|
+
*/
|
|
14
|
+
priority?: boolean;
|
|
15
|
+
}
|
|
16
|
+
interface LinkProps extends ComponentProps<'a'> {
|
|
17
|
+
prefetch?: boolean;
|
|
18
|
+
}
|
|
19
|
+
interface Router {
|
|
20
|
+
push: (url: string) => void;
|
|
21
|
+
refresh: () => void;
|
|
22
|
+
}
|
|
23
|
+
interface Framework {
|
|
24
|
+
usePathname: () => string;
|
|
25
|
+
useParams: () => Record<string, string | string[]>;
|
|
26
|
+
useRouter: () => Router;
|
|
27
|
+
Link?: FC<ComponentProps<'a'> & {
|
|
28
|
+
prefetch?: boolean;
|
|
29
|
+
}>;
|
|
30
|
+
Image?: FC<ImageProps>;
|
|
31
|
+
}
|
|
32
|
+
declare function FrameworkProvider({ children, ...props }: Framework & {
|
|
33
|
+
children: ReactNode;
|
|
34
|
+
}): react_jsx_runtime.JSX.Element;
|
|
35
|
+
declare function usePathname(): string;
|
|
36
|
+
declare function useRouter(): Router;
|
|
37
|
+
declare function useParams(): Record<string, string | string[]>;
|
|
38
|
+
declare function Image(props: ImageProps): react_jsx_runtime.JSX.Element;
|
|
39
|
+
declare function Link(props: LinkProps): react_jsx_runtime.JSX.Element;
|
|
40
|
+
declare function createContext<T>(name: string, v?: T): {
|
|
41
|
+
Provider: (props: {
|
|
42
|
+
value: T;
|
|
43
|
+
children: ReactNode;
|
|
44
|
+
}) => react_jsx_runtime.JSX.Element;
|
|
45
|
+
use: (errorMessage?: string) => Exclude<T, undefined | null>;
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
export { type Framework, FrameworkProvider, Image, type ImageProps, Link, type Router, createContext, useParams, usePathname, useRouter };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import {
|
|
3
|
+
FrameworkProvider,
|
|
4
|
+
Image,
|
|
5
|
+
Link,
|
|
6
|
+
createContext,
|
|
7
|
+
useParams,
|
|
8
|
+
usePathname,
|
|
9
|
+
useRouter
|
|
10
|
+
} from "../chunk-FVY6EZ3N.js";
|
|
11
|
+
import "../chunk-MLKGABMK.js";
|
|
12
|
+
export {
|
|
13
|
+
FrameworkProvider,
|
|
14
|
+
Image,
|
|
15
|
+
Link,
|
|
16
|
+
createContext,
|
|
17
|
+
useParams,
|
|
18
|
+
usePathname,
|
|
19
|
+
useRouter
|
|
20
|
+
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import {
|
|
3
|
+
FrameworkProvider
|
|
4
|
+
} from "../chunk-FVY6EZ3N.js";
|
|
5
|
+
import "../chunk-MLKGABMK.js";
|
|
6
|
+
|
|
7
|
+
// src/framework/next.tsx
|
|
8
|
+
import { useParams, usePathname, useRouter } from "next/navigation";
|
|
9
|
+
import Link from "next/link";
|
|
10
|
+
import Image from "next/image";
|
|
11
|
+
import { jsx } from "react/jsx-runtime";
|
|
12
|
+
function NextProvider({ children }) {
|
|
13
|
+
return /* @__PURE__ */ jsx(
|
|
14
|
+
FrameworkProvider,
|
|
15
|
+
{
|
|
16
|
+
usePathname,
|
|
17
|
+
useRouter,
|
|
18
|
+
useParams,
|
|
19
|
+
Link,
|
|
20
|
+
Image,
|
|
21
|
+
children
|
|
22
|
+
}
|
|
23
|
+
);
|
|
24
|
+
}
|
|
25
|
+
export {
|
|
26
|
+
NextProvider
|
|
27
|
+
};
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import {
|
|
2
|
+
FrameworkProvider
|
|
3
|
+
} from "../chunk-FVY6EZ3N.js";
|
|
4
|
+
import "../chunk-MLKGABMK.js";
|
|
5
|
+
|
|
6
|
+
// src/framework/react-router.tsx
|
|
7
|
+
import { useMemo } from "react";
|
|
8
|
+
import {
|
|
9
|
+
Link,
|
|
10
|
+
useLocation,
|
|
11
|
+
useNavigate,
|
|
12
|
+
useParams,
|
|
13
|
+
useRevalidator
|
|
14
|
+
} from "react-router";
|
|
15
|
+
import { jsx } from "react/jsx-runtime";
|
|
16
|
+
var framework = {
|
|
17
|
+
usePathname() {
|
|
18
|
+
return useLocation().pathname;
|
|
19
|
+
},
|
|
20
|
+
useParams() {
|
|
21
|
+
return useParams();
|
|
22
|
+
},
|
|
23
|
+
useRouter() {
|
|
24
|
+
const navigate = useNavigate();
|
|
25
|
+
const revalidator = useRevalidator();
|
|
26
|
+
return useMemo(
|
|
27
|
+
() => ({
|
|
28
|
+
push(url) {
|
|
29
|
+
navigate(url);
|
|
30
|
+
},
|
|
31
|
+
refresh() {
|
|
32
|
+
void revalidator.revalidate();
|
|
33
|
+
}
|
|
34
|
+
}),
|
|
35
|
+
[navigate, revalidator]
|
|
36
|
+
);
|
|
37
|
+
},
|
|
38
|
+
Link({ href, prefetch, ...props }) {
|
|
39
|
+
return /* @__PURE__ */ jsx(Link, { to: href, prefetch: prefetch ? "intent" : "none", ...props, children: props.children });
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
function ReactRouterProvider({ children }) {
|
|
43
|
+
return /* @__PURE__ */ jsx(FrameworkProvider, { ...framework, children });
|
|
44
|
+
}
|
|
45
|
+
export {
|
|
46
|
+
ReactRouterProvider
|
|
47
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { ReactNode } from 'react';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Fumadocs adapter for Tanstack Router/Start
|
|
6
|
+
*/
|
|
7
|
+
declare function TanstackProvider({ children }: {
|
|
8
|
+
children: ReactNode;
|
|
9
|
+
}): react_jsx_runtime.JSX.Element;
|
|
10
|
+
|
|
11
|
+
export { TanstackProvider };
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import {
|
|
2
|
+
FrameworkProvider
|
|
3
|
+
} from "../chunk-FVY6EZ3N.js";
|
|
4
|
+
import "../chunk-MLKGABMK.js";
|
|
5
|
+
|
|
6
|
+
// src/framework/tanstack.tsx
|
|
7
|
+
import { useMemo } from "react";
|
|
8
|
+
import {
|
|
9
|
+
useParams,
|
|
10
|
+
Link,
|
|
11
|
+
useRouter,
|
|
12
|
+
useLocation
|
|
13
|
+
} from "@tanstack/react-router";
|
|
14
|
+
import { jsx } from "react/jsx-runtime";
|
|
15
|
+
var framework = {
|
|
16
|
+
Link({ href, prefetch, ...props }) {
|
|
17
|
+
return /* @__PURE__ */ jsx(Link, { to: href, preload: prefetch ? "intent" : false, ...props, children: props.children });
|
|
18
|
+
},
|
|
19
|
+
usePathname() {
|
|
20
|
+
return useLocation().pathname;
|
|
21
|
+
},
|
|
22
|
+
useRouter() {
|
|
23
|
+
const router = useRouter();
|
|
24
|
+
return useMemo(
|
|
25
|
+
() => ({
|
|
26
|
+
push(url) {
|
|
27
|
+
void router.navigate({
|
|
28
|
+
href: url
|
|
29
|
+
});
|
|
30
|
+
},
|
|
31
|
+
refresh() {
|
|
32
|
+
void router.invalidate();
|
|
33
|
+
}
|
|
34
|
+
}),
|
|
35
|
+
[router]
|
|
36
|
+
);
|
|
37
|
+
},
|
|
38
|
+
useParams() {
|
|
39
|
+
return useParams({ strict: false });
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
function TanstackProvider({ children }) {
|
|
43
|
+
return /* @__PURE__ */ jsx(FrameworkProvider, { ...framework, children });
|
|
44
|
+
}
|
|
45
|
+
export {
|
|
46
|
+
TanstackProvider
|
|
47
|
+
};
|
package/dist/highlight/client.js
CHANGED
|
@@ -1,9 +1,102 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
_highlight,
|
|
4
|
+
_renderHighlight,
|
|
5
|
+
highlight
|
|
6
|
+
} from "../chunk-BUCUQ3WX.js";
|
|
6
7
|
import "../chunk-MLKGABMK.js";
|
|
8
|
+
|
|
9
|
+
// src/highlight/client.tsx
|
|
10
|
+
import {
|
|
11
|
+
useId,
|
|
12
|
+
useMemo,
|
|
13
|
+
useRef,
|
|
14
|
+
use,
|
|
15
|
+
useState,
|
|
16
|
+
useLayoutEffect
|
|
17
|
+
} from "react";
|
|
18
|
+
import { jsx } from "react/jsx-runtime";
|
|
19
|
+
var jsEngine;
|
|
20
|
+
function getHighlightOptions(from) {
|
|
21
|
+
if (from.engine) return from;
|
|
22
|
+
if (!jsEngine) {
|
|
23
|
+
jsEngine = import("shiki/engine/javascript").then(
|
|
24
|
+
(res) => res.createJavaScriptRegexEngine()
|
|
25
|
+
);
|
|
26
|
+
}
|
|
27
|
+
return {
|
|
28
|
+
...from,
|
|
29
|
+
engine: jsEngine
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
function useShiki(code, {
|
|
33
|
+
defaultValue,
|
|
34
|
+
withPrerenderScript = false,
|
|
35
|
+
...options
|
|
36
|
+
}, deps) {
|
|
37
|
+
const markupId = useId();
|
|
38
|
+
const key = useMemo(
|
|
39
|
+
() => deps ? JSON.stringify(deps) : `${options.lang}:${code}`,
|
|
40
|
+
[code, deps, options.lang]
|
|
41
|
+
);
|
|
42
|
+
const shikiOptions = getHighlightOptions(options);
|
|
43
|
+
const currentTask = useRef({
|
|
44
|
+
key,
|
|
45
|
+
aborted: false
|
|
46
|
+
});
|
|
47
|
+
const [rendered, setRendered] = useState(() => {
|
|
48
|
+
if (defaultValue) return defaultValue;
|
|
49
|
+
const element = withPrerenderScript && typeof document !== "undefined" ? document.querySelector(`[data-markup-id="${markupId}"]`) : null;
|
|
50
|
+
const attr = element?.getAttribute("data-markup");
|
|
51
|
+
if (attr) {
|
|
52
|
+
const hast = JSON.parse(attr);
|
|
53
|
+
return renderHighlightWithMarkup(markupId, hast, shikiOptions, attr);
|
|
54
|
+
}
|
|
55
|
+
currentTask.current = void 0;
|
|
56
|
+
const Pre = options.components?.pre ?? "pre";
|
|
57
|
+
const Code = options.components?.code ?? "code";
|
|
58
|
+
return /* @__PURE__ */ jsx(Pre, { children: /* @__PURE__ */ jsx(Code, { children: code }) });
|
|
59
|
+
});
|
|
60
|
+
useLayoutEffect(() => {
|
|
61
|
+
if (currentTask.current?.key === key) return;
|
|
62
|
+
if (currentTask.current) {
|
|
63
|
+
currentTask.current.aborted = true;
|
|
64
|
+
}
|
|
65
|
+
const task = {
|
|
66
|
+
key,
|
|
67
|
+
aborted: false
|
|
68
|
+
};
|
|
69
|
+
currentTask.current = task;
|
|
70
|
+
void highlight(code, shikiOptions).then((result) => {
|
|
71
|
+
if (!task.aborted) setRendered(result);
|
|
72
|
+
});
|
|
73
|
+
}, [key]);
|
|
74
|
+
if (typeof window === "undefined") {
|
|
75
|
+
return use(
|
|
76
|
+
_highlight(code, shikiOptions).then(
|
|
77
|
+
(tree) => renderHighlightWithMarkup(markupId, tree, shikiOptions)
|
|
78
|
+
)
|
|
79
|
+
);
|
|
80
|
+
}
|
|
81
|
+
return rendered;
|
|
82
|
+
}
|
|
83
|
+
function renderHighlightWithMarkup(id, tree, shikiOptions, rawAttr) {
|
|
84
|
+
const Pre = shikiOptions.components?.pre ?? "pre";
|
|
85
|
+
return _renderHighlight(tree, {
|
|
86
|
+
...shikiOptions,
|
|
87
|
+
components: {
|
|
88
|
+
...shikiOptions.components,
|
|
89
|
+
pre: (props) => /* @__PURE__ */ jsx(
|
|
90
|
+
Pre,
|
|
91
|
+
{
|
|
92
|
+
...props,
|
|
93
|
+
"data-markup-id": id,
|
|
94
|
+
"data-markup": rawAttr ?? JSON.stringify(tree)
|
|
95
|
+
}
|
|
96
|
+
)
|
|
97
|
+
}
|
|
98
|
+
});
|
|
99
|
+
}
|
|
7
100
|
export {
|
|
8
101
|
useShiki
|
|
9
102
|
};
|
package/dist/highlight/index.js
CHANGED
package/dist/link.d.ts
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
2
|
import { AnchorHTMLAttributes } from 'react';
|
|
3
|
-
import { LinkProps as LinkProps$1 } from 'next/link';
|
|
4
3
|
|
|
5
|
-
interface LinkProps extends
|
|
4
|
+
interface LinkProps extends AnchorHTMLAttributes<HTMLAnchorElement> {
|
|
6
5
|
/**
|
|
7
6
|
* If the href is an external URL
|
|
8
7
|
*
|
|
9
8
|
* automatically determined by default
|
|
10
9
|
*/
|
|
11
10
|
external?: boolean;
|
|
11
|
+
/**
|
|
12
|
+
* Prefetch links, supported on Next.js
|
|
13
|
+
*/
|
|
14
|
+
prefetch?: boolean;
|
|
12
15
|
}
|
|
13
|
-
/**
|
|
14
|
-
* Wraps `next/link` and safe to use in MDX documents
|
|
15
|
-
*/
|
|
16
16
|
declare const Link: react.ForwardRefExoticComponent<LinkProps & react.RefAttributes<HTMLAnchorElement>>;
|
|
17
17
|
|
|
18
18
|
export { type LinkProps, Link as default };
|
package/dist/link.js
CHANGED
|
@@ -192,6 +192,7 @@ var metaValues = [
|
|
|
192
192
|
}
|
|
193
193
|
];
|
|
194
194
|
var rehypeCodeDefaultOptions = {
|
|
195
|
+
lazy: true,
|
|
195
196
|
themes: defaultThemes,
|
|
196
197
|
defaultColor: false,
|
|
197
198
|
defaultLanguage: "plaintext",
|
|
@@ -713,6 +714,7 @@ function rehypeToc({ exportToc = true } = {}) {
|
|
|
713
714
|
exportToc ? {
|
|
714
715
|
type: "ExportNamedDeclaration",
|
|
715
716
|
declaration,
|
|
717
|
+
attributes: [],
|
|
716
718
|
specifiers: []
|
|
717
719
|
} : declaration
|
|
718
720
|
],
|
package/dist/server/index.d.ts
CHANGED
|
@@ -5,14 +5,10 @@ export { S as SortedResult } from '../types-Ch8gnVgO.js';
|
|
|
5
5
|
import { Metadata } from 'next';
|
|
6
6
|
import { NextRequest } from 'next/server';
|
|
7
7
|
import { LoaderOutput, LoaderConfig, InferPageType } from '../source/index.js';
|
|
8
|
-
export { HighlightOptions, createStyleTransformer, highlight } from '../highlight/index.js';
|
|
9
8
|
import 'react';
|
|
10
9
|
import 'unified';
|
|
11
10
|
import 'vfile';
|
|
12
11
|
import '../config-inq6kP6y.js';
|
|
13
|
-
import 'shiki';
|
|
14
|
-
import 'shiki/themes';
|
|
15
|
-
import 'hast-util-to-jsx-runtime';
|
|
16
12
|
|
|
17
13
|
/**
|
|
18
14
|
* Flatten tree to an array of page nodes
|
package/dist/server/index.js
CHANGED
|
@@ -1,11 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
remarkHeading
|
|
3
3
|
} from "../chunk-IYQ35KI2.js";
|
|
4
|
-
import "../chunk-WQMD6AUR.js";
|
|
5
|
-
import {
|
|
6
|
-
createStyleTransformer,
|
|
7
|
-
highlight
|
|
8
|
-
} from "../chunk-BUCUQ3WX.js";
|
|
9
4
|
import "../chunk-MLKGABMK.js";
|
|
10
5
|
|
|
11
6
|
// src/server/get-toc.ts
|
|
@@ -116,7 +111,6 @@ async function getGithubLastEdit({
|
|
|
116
111
|
}
|
|
117
112
|
|
|
118
113
|
// src/server/metadata.ts
|
|
119
|
-
import { notFound } from "next/navigation";
|
|
120
114
|
function createMetadataImage(options) {
|
|
121
115
|
const { filename = "image.png", imageRoute = "/docs-og" } = options;
|
|
122
116
|
function getImageMeta(slugs) {
|
|
@@ -165,7 +159,10 @@ function createMetadataImage(options) {
|
|
|
165
159
|
//remove filename
|
|
166
160
|
lang
|
|
167
161
|
);
|
|
168
|
-
if (!page)
|
|
162
|
+
if (!page)
|
|
163
|
+
return new Response(null, {
|
|
164
|
+
status: 404
|
|
165
|
+
});
|
|
169
166
|
return handler(page, req, { params: input });
|
|
170
167
|
};
|
|
171
168
|
}
|
|
@@ -174,12 +171,10 @@ function createMetadataImage(options) {
|
|
|
174
171
|
export {
|
|
175
172
|
page_tree_exports as PageTree,
|
|
176
173
|
createMetadataImage,
|
|
177
|
-
createStyleTransformer,
|
|
178
174
|
findNeighbour,
|
|
179
175
|
flattenTree,
|
|
180
176
|
getGithubLastEdit,
|
|
181
177
|
getPageTreeRoots,
|
|
182
178
|
getTableOfContents,
|
|
183
|
-
highlight,
|
|
184
179
|
separatePageTree
|
|
185
180
|
};
|
package/dist/source/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "fumadocs-core",
|
|
3
|
-
"version": "15.1
|
|
3
|
+
"version": "15.2.1",
|
|
4
4
|
"description": "The library for building a documentation website in Next.js",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"NextJs",
|
|
@@ -24,21 +24,9 @@
|
|
|
24
24
|
"import": "./dist/toc.js",
|
|
25
25
|
"types": "./dist/toc.d.ts"
|
|
26
26
|
},
|
|
27
|
-
"./search
|
|
28
|
-
"import": "./dist/search
|
|
29
|
-
"types": "./dist/search
|
|
30
|
-
},
|
|
31
|
-
"./search/server": {
|
|
32
|
-
"import": "./dist/search/server.js",
|
|
33
|
-
"types": "./dist/search/server.d.ts"
|
|
34
|
-
},
|
|
35
|
-
"./search/algolia": {
|
|
36
|
-
"import": "./dist/search/algolia.js",
|
|
37
|
-
"types": "./dist/search/algolia.d.ts"
|
|
38
|
-
},
|
|
39
|
-
"./search/orama-cloud": {
|
|
40
|
-
"import": "./dist/search/orama-cloud.js",
|
|
41
|
-
"types": "./dist/search/orama-cloud.d.ts"
|
|
27
|
+
"./search/*": {
|
|
28
|
+
"import": "./dist/search/*.js",
|
|
29
|
+
"types": "./dist/search/*.d.ts"
|
|
42
30
|
},
|
|
43
31
|
"./server": {
|
|
44
32
|
"import": "./dist/server/index.js",
|
|
@@ -48,17 +36,9 @@
|
|
|
48
36
|
"import": "./dist/source/index.js",
|
|
49
37
|
"types": "./dist/source/index.d.ts"
|
|
50
38
|
},
|
|
51
|
-
"./utils
|
|
52
|
-
"import": "./dist/utils
|
|
53
|
-
"types": "./dist/utils
|
|
54
|
-
},
|
|
55
|
-
"./utils/use-shiki": {
|
|
56
|
-
"import": "./dist/utils/use-shiki.js",
|
|
57
|
-
"types": "./dist/utils/use-shiki.d.ts"
|
|
58
|
-
},
|
|
59
|
-
"./utils/use-effect-event": {
|
|
60
|
-
"import": "./dist/utils/use-effect-event.js",
|
|
61
|
-
"types": "./dist/utils/use-effect-event.d.ts"
|
|
39
|
+
"./utils/*": {
|
|
40
|
+
"import": "./dist/utils/*.js",
|
|
41
|
+
"types": "./dist/utils/*.d.ts"
|
|
62
42
|
},
|
|
63
43
|
"./link": {
|
|
64
44
|
"import": "./dist/link.js",
|
|
@@ -83,14 +63,22 @@
|
|
|
83
63
|
"./highlight/client": {
|
|
84
64
|
"import": "./dist/highlight/client.js",
|
|
85
65
|
"types": "./dist/highlight/client.d.ts"
|
|
66
|
+
},
|
|
67
|
+
"./framework": {
|
|
68
|
+
"import": "./dist/framework/index.js",
|
|
69
|
+
"types": "./dist/framework/index.d.ts"
|
|
70
|
+
},
|
|
71
|
+
"./framework/*": {
|
|
72
|
+
"import": "./dist/framework/*.js",
|
|
73
|
+
"types": "./dist/framework/*.d.ts"
|
|
86
74
|
}
|
|
87
75
|
},
|
|
88
76
|
"files": [
|
|
89
77
|
"dist/*"
|
|
90
78
|
],
|
|
91
79
|
"dependencies": {
|
|
92
|
-
"@formatjs/intl-localematcher": "^0.6.
|
|
93
|
-
"@orama/orama": "^3.1.
|
|
80
|
+
"@formatjs/intl-localematcher": "^0.6.1",
|
|
81
|
+
"@orama/orama": "^3.1.4",
|
|
94
82
|
"@shikijs/rehype": "^3.2.1",
|
|
95
83
|
"@shikijs/transformers": "^3.2.1",
|
|
96
84
|
"github-slugger": "^2.0.0",
|
|
@@ -109,17 +97,19 @@
|
|
|
109
97
|
"@algolia/client-search": "4.24.0",
|
|
110
98
|
"@mdx-js/mdx": "^3.1.0",
|
|
111
99
|
"@oramacloud/client": "^2.1.4",
|
|
100
|
+
"@tanstack/react-router": "^1.114.29",
|
|
112
101
|
"@types/estree-jsx": "^1.0.5",
|
|
113
102
|
"@types/hast": "^3.0.4",
|
|
114
103
|
"@types/mdast": "^4.0.3",
|
|
115
104
|
"@types/negotiator": "^0.6.3",
|
|
116
|
-
"@types/node": "22.13.
|
|
105
|
+
"@types/node": "22.13.14",
|
|
117
106
|
"@types/react": "^19.0.12",
|
|
118
107
|
"@types/react-dom": "^19.0.4",
|
|
119
108
|
"algoliasearch": "4.24.0",
|
|
120
109
|
"mdast-util-mdx-jsx": "^3.2.0",
|
|
121
110
|
"mdast-util-mdxjs-esm": "^2.0.1",
|
|
122
|
-
"next": "^15.2.
|
|
111
|
+
"next": "^15.2.4",
|
|
112
|
+
"react-router": "^7.4.1",
|
|
123
113
|
"remark-mdx": "^3.1.0",
|
|
124
114
|
"remark-rehype": "^11.1.1",
|
|
125
115
|
"typescript": "^5.8.2",
|
package/dist/chunk-62S4EN7J.js
DELETED
|
@@ -1,101 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
_highlight,
|
|
3
|
-
_renderHighlight,
|
|
4
|
-
highlight
|
|
5
|
-
} from "./chunk-BUCUQ3WX.js";
|
|
6
|
-
|
|
7
|
-
// src/highlight/client.tsx
|
|
8
|
-
import {
|
|
9
|
-
useId,
|
|
10
|
-
useMemo,
|
|
11
|
-
useRef,
|
|
12
|
-
use,
|
|
13
|
-
useState,
|
|
14
|
-
useLayoutEffect
|
|
15
|
-
} from "react";
|
|
16
|
-
import { jsx } from "react/jsx-runtime";
|
|
17
|
-
var jsEngine;
|
|
18
|
-
function getHighlightOptions(from) {
|
|
19
|
-
if (from.engine) return from;
|
|
20
|
-
if (!jsEngine) {
|
|
21
|
-
jsEngine = import("shiki/engine/javascript").then(
|
|
22
|
-
(res) => res.createJavaScriptRegexEngine()
|
|
23
|
-
);
|
|
24
|
-
}
|
|
25
|
-
return {
|
|
26
|
-
...from,
|
|
27
|
-
engine: jsEngine
|
|
28
|
-
};
|
|
29
|
-
}
|
|
30
|
-
function useShiki(code, {
|
|
31
|
-
defaultValue,
|
|
32
|
-
withPrerenderScript = false,
|
|
33
|
-
...options
|
|
34
|
-
}, deps) {
|
|
35
|
-
const markupId = useId();
|
|
36
|
-
const key = useMemo(
|
|
37
|
-
() => deps ? JSON.stringify(deps) : `${options.lang}:${code}`,
|
|
38
|
-
[code, deps, options.lang]
|
|
39
|
-
);
|
|
40
|
-
const shikiOptions = getHighlightOptions(options);
|
|
41
|
-
const currentTask = useRef({
|
|
42
|
-
key,
|
|
43
|
-
aborted: false
|
|
44
|
-
});
|
|
45
|
-
const [rendered, setRendered] = useState(() => {
|
|
46
|
-
if (defaultValue) return defaultValue;
|
|
47
|
-
const element = withPrerenderScript && typeof document !== "undefined" ? document.querySelector(`[data-markup-id="${markupId}"]`) : null;
|
|
48
|
-
const attr = element?.getAttribute("data-markup");
|
|
49
|
-
if (attr) {
|
|
50
|
-
const hast = JSON.parse(attr);
|
|
51
|
-
return renderHighlightWithMarkup(markupId, hast, shikiOptions, attr);
|
|
52
|
-
}
|
|
53
|
-
currentTask.current = void 0;
|
|
54
|
-
const Pre = options.components?.pre ?? "pre";
|
|
55
|
-
const Code = options.components?.code ?? "code";
|
|
56
|
-
return /* @__PURE__ */ jsx(Pre, { children: /* @__PURE__ */ jsx(Code, { children: code }) });
|
|
57
|
-
});
|
|
58
|
-
useLayoutEffect(() => {
|
|
59
|
-
if (currentTask.current?.key === key) return;
|
|
60
|
-
if (currentTask.current) {
|
|
61
|
-
currentTask.current.aborted = true;
|
|
62
|
-
}
|
|
63
|
-
const task = {
|
|
64
|
-
key,
|
|
65
|
-
aborted: false
|
|
66
|
-
};
|
|
67
|
-
currentTask.current = task;
|
|
68
|
-
void highlight(code, shikiOptions).then((result) => {
|
|
69
|
-
if (!task.aborted) setRendered(result);
|
|
70
|
-
});
|
|
71
|
-
}, [key]);
|
|
72
|
-
if (typeof window === "undefined") {
|
|
73
|
-
return use(
|
|
74
|
-
_highlight(code, shikiOptions).then(
|
|
75
|
-
(tree) => renderHighlightWithMarkup(markupId, tree, shikiOptions)
|
|
76
|
-
)
|
|
77
|
-
);
|
|
78
|
-
}
|
|
79
|
-
return rendered;
|
|
80
|
-
}
|
|
81
|
-
function renderHighlightWithMarkup(id, tree, shikiOptions, rawAttr) {
|
|
82
|
-
const Pre = shikiOptions.components?.pre ?? "pre";
|
|
83
|
-
return _renderHighlight(tree, {
|
|
84
|
-
...shikiOptions,
|
|
85
|
-
components: {
|
|
86
|
-
...shikiOptions.components,
|
|
87
|
-
pre: (props) => /* @__PURE__ */ jsx(
|
|
88
|
-
Pre,
|
|
89
|
-
{
|
|
90
|
-
...props,
|
|
91
|
-
"data-markup-id": id,
|
|
92
|
-
"data-markup": rawAttr ?? JSON.stringify(tree)
|
|
93
|
-
}
|
|
94
|
-
)
|
|
95
|
-
}
|
|
96
|
-
});
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
export {
|
|
100
|
-
useShiki
|
|
101
|
-
};
|
package/dist/chunk-WQMD6AUR.js
DELETED
|
File without changes
|