fumadocs-core 16.5.0 → 16.5.2
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/{advanced-TWQmNf5Z.js → advanced-BH0syJ-M.js} +2 -2
- package/dist/{algolia-DCfk4Vr4.js → algolia-C7Crg8-5.js} +1 -1
- package/dist/breadcrumb.d.ts +1 -1
- package/dist/breadcrumb.js +2 -2
- package/dist/{chunk-cfOgR2JL.js → chunk-CaR5F9JI.js} +3 -3
- package/dist/content/index.d.ts +2 -2
- package/dist/content/mdx/preset-bundler.d.ts +8 -10
- package/dist/content/mdx/preset-bundler.js +1 -1
- package/dist/content/mdx/preset-runtime.d.ts +8 -10
- package/dist/content/mdx/preset-runtime.js +1 -1
- package/dist/content/toc.d.ts +0 -1
- package/dist/content/toc.js +3 -3
- package/dist/create-i18n-Cv3Cocbs.d.ts +51 -0
- package/dist/dynamic-link.d.ts +2 -2
- package/dist/dynamic-link.js +1 -2
- package/dist/framework/index.d.ts +4 -4
- package/dist/framework/index.js +17 -17
- package/dist/framework/next.d.ts +2 -2
- package/dist/framework/tanstack.d.ts +2 -2
- package/dist/framework/waku.d.ts +2 -2
- package/dist/hast-utils-BmGqqmvo.js +15 -0
- package/dist/highlight/client.d.ts +0 -3
- package/dist/highlight/client.js +1 -2
- package/dist/highlight/config.d.ts +14 -1
- package/dist/highlight/config.js +16 -1
- package/dist/highlight/core/client.d.ts +5 -5
- package/dist/highlight/core/client.js +1 -1
- package/dist/highlight/core/index.d.ts +26 -2
- package/dist/highlight/core/index.js +67 -1
- package/dist/highlight/index.d.ts +5 -5
- package/dist/highlight/index.js +56 -2
- package/dist/i18n/index.d.ts +39 -1
- package/dist/i18n/middleware.d.ts +1 -1
- package/dist/link.d.ts +2 -2
- package/dist/mdx-plugins/codeblock-utils.d.ts +35 -1
- package/dist/mdx-plugins/codeblock-utils.js +68 -1
- package/dist/mdx-plugins/index.d.ts +17 -17
- package/dist/mdx-plugins/index.js +5 -6
- package/dist/mdx-plugins/rehype-code.core.d.ts +38 -3
- package/dist/mdx-plugins/rehype-code.core.js +102 -1
- package/dist/mdx-plugins/rehype-code.d.ts +18 -4
- package/dist/mdx-plugins/rehype-code.js +3 -3
- package/dist/mdx-plugins/rehype-toc.d.ts +16 -1
- package/dist/mdx-plugins/rehype-toc.js +127 -1
- package/dist/mdx-plugins/remark-admonition.d.ts +20 -1
- package/dist/mdx-plugins/remark-admonition.js +1 -1
- package/dist/mdx-plugins/remark-code-tab.d.ts +30 -1
- package/dist/mdx-plugins/remark-code-tab.js +4 -4
- package/dist/mdx-plugins/remark-directive-admonition.d.ts +34 -1
- package/dist/mdx-plugins/remark-feedback-block.d.ts +50 -1
- package/dist/mdx-plugins/remark-feedback-block.js +1 -1
- package/dist/mdx-plugins/remark-gfm.d.ts +2 -2
- package/dist/mdx-plugins/remark-heading.d.ts +35 -1
- package/dist/mdx-plugins/remark-heading.js +1 -1
- package/dist/mdx-plugins/remark-image.d.ts +63 -1
- package/dist/mdx-plugins/remark-mdx-files.d.ts +54 -1
- package/dist/mdx-plugins/remark-mdx-mermaid.d.ts +15 -1
- package/dist/mdx-plugins/remark-npm.d.ts +34 -1
- package/dist/mdx-plugins/remark-npm.js +1 -1
- package/dist/mdx-plugins/remark-steps.d.ts +26 -1
- package/dist/mdx-plugins/remark-structure.d.ts +75 -1
- package/dist/mdx-plugins/remark-structure.js +6 -6
- package/dist/{mixedbread-BG4UeXiU.js → mixedbread-Bx9drx9S.js} +1 -1
- package/dist/{orama-cloud-Wo-D5oP_.js → orama-cloud-ByznDyOk.js} +5 -5
- package/dist/{orama-cloud-legacy-CFdIdpme.js → orama-cloud-legacy-BbgJnf5f.js} +5 -5
- package/dist/page-tree/index.d.ts +2 -2
- package/dist/page-tree/index.js +1 -1
- package/dist/{index-CUq6AiCx.d.ts → path-B77y3W0_.d.ts} +60 -79
- package/dist/{path-CsdzZWvc.js → path-D0Bwm6Fs.js} +1 -1
- package/dist/search/algolia.d.ts +66 -2
- package/dist/search/client.d.ts +6 -7
- package/dist/search/client.js +8 -8
- package/dist/search/index.js +41 -1
- package/dist/search/orama-cloud-legacy.d.ts +2 -7
- package/dist/search/orama-cloud.d.ts +2 -7
- package/dist/search/server.d.ts +87 -6
- package/dist/search/server.js +6 -6
- package/dist/source/client/index.d.ts +19 -3
- package/dist/source/client/index.js +1 -1
- package/dist/source/index.d.ts +5 -5
- package/dist/source/index.js +90 -90
- package/dist/source/plugins/lucide-icons.d.ts +4 -4
- package/dist/source/plugins/lucide-icons.js +1 -1
- package/dist/source/plugins/slugs.d.ts +24 -4
- package/dist/source/plugins/slugs.js +1 -1
- package/dist/source/plugins/status-badges.d.ts +3 -4
- package/dist/source/schema.d.ts +0 -1
- package/dist/{static-Dt2cKb--.js → static-DTxK4eHk.js} +4 -4
- package/dist/{rehype-code.core-CyhJRC1n.js → transformer-icon-BYedaeE8.js} +1 -103
- package/dist/transformer-icon-D7-6aFzt.d.ts +18 -0
- package/dist/{utils-DNZN_49E.js → utils-Bc53B3CJ.js} +7 -5
- package/dist/{index-CFA6GwWf.d.ts → utils-IgHyYnrz.d.ts} +4 -3
- package/package.json +35 -15
- package/dist/algolia-CKy1lM9u.d.ts +0 -67
- package/dist/codeblock-utils-D0fA-OE7.d.ts +0 -36
- package/dist/codeblock-utils-DI7Z9xql.js +0 -70
- package/dist/config-BgtobXdR.js +0 -18
- package/dist/config-DJdZBZlh.d.ts +0 -15
- package/dist/core-CDn7C7VL.js +0 -69
- package/dist/highlight-SdB0Qf0G.js +0 -58
- package/dist/index-BEo01H18.d.ts +0 -40
- package/dist/index-D2-6Onl4.d.ts +0 -27
- package/dist/index-DOlhKsaS.d.ts +0 -18
- package/dist/rehype-code-Co0kqUkv.d.ts +0 -17
- package/dist/rehype-code.core-CWF-IQ2P.d.ts +0 -52
- package/dist/rehype-toc-AK0J4UuV.d.ts +0 -17
- package/dist/rehype-toc-Dl3kdPzo.js +0 -142
- package/dist/remark-admonition-N6aD1bW6.d.ts +0 -21
- package/dist/remark-code-tab-Bstdspbi.d.ts +0 -31
- package/dist/remark-directive-admonition-_SM5PjAu.d.ts +0 -35
- package/dist/remark-feedback-block-Ceky1jO_.d.ts +0 -51
- package/dist/remark-gfm-DgxIxMeJ.d.ts +0 -2
- package/dist/remark-heading-BxdIuF4B.d.ts +0 -36
- package/dist/remark-image-CMdNSKY2.d.ts +0 -64
- package/dist/remark-mdx-files-DcQ16Yrj.d.ts +0 -55
- package/dist/remark-mdx-mermaid-Z6TVYzuk.d.ts +0 -16
- package/dist/remark-npm-BoGbUMH7.d.ts +0 -35
- package/dist/remark-steps-BQxFifGk.d.ts +0 -27
- package/dist/remark-structure-CBAW3qA0.d.ts +0 -76
- package/dist/search-BBwdBAje.js +0 -43
- package/dist/server-CWnxTroQ.d.ts +0 -132
- /package/dist/{definitions-BAonfAPX.d.ts → definitions-DSNTbAwC.d.ts} +0 -0
- /package/dist/{fetch-jqX0pB_v.js → fetch-HotVeLLF.js} +0 -0
- /package/dist/{icon-BDV-rZ86.js → icon-BcFuYa-b.js} +0 -0
- /package/dist/{mdast-utils-Bs8hd8qh.js → mdast-utils-gJMY143g.js} +0 -0
- /package/dist/{normalize-url-CjiL47SL.js → normalize-url-DKBxIxO0.js} +0 -0
- /package/dist/{remove-undefined-DRuHyD77.js → remove-undefined-CJm9cyrC.js} +0 -0
- /package/dist/{types-sj9GyWJ2.d.ts → types-BSnJn7kF.d.ts} +0 -0
- /package/dist/{util-Cwgkie_j.d.ts → util-C60LmklF.d.ts} +0 -0
- /package/dist/{util-BX-jUN1T.js → util-De0ALHOx.js} +0 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { t as removeUndefined } from "./remove-undefined-
|
|
1
|
+
import { createContentHighlighter } from "./search/index.js";
|
|
2
|
+
import { t as removeUndefined } from "./remove-undefined-CJm9cyrC.js";
|
|
3
3
|
import { getByID, search } from "@orama/orama";
|
|
4
4
|
|
|
5
5
|
//#region src/search/orama/search/simple.ts
|
package/dist/breadcrumb.d.ts
CHANGED
package/dist/breadcrumb.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { t as normalizeUrl } from "./normalize-url-
|
|
2
|
-
import { r as findPath } from "./utils-
|
|
1
|
+
import { t as normalizeUrl } from "./normalize-url-DKBxIxO0.js";
|
|
2
|
+
import { r as findPath } from "./utils-Bc53B3CJ.js";
|
|
3
3
|
import { useMemo } from "react";
|
|
4
4
|
|
|
5
5
|
//#region src/breadcrumb.tsx
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
//#region
|
|
1
|
+
//#region \0rolldown/runtime.js
|
|
2
2
|
var __create = Object.create;
|
|
3
3
|
var __defProp = Object.defineProperty;
|
|
4
4
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
@@ -6,7 +6,7 @@ var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
|
6
6
|
var __getProtoOf = Object.getPrototypeOf;
|
|
7
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
8
|
var __commonJSMin = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
|
|
9
|
-
var __exportAll = (all,
|
|
9
|
+
var __exportAll = (all, no_symbols) => {
|
|
10
10
|
let target = {};
|
|
11
11
|
for (var name in all) {
|
|
12
12
|
__defProp(target, name, {
|
|
@@ -14,7 +14,7 @@ var __exportAll = (all, symbols) => {
|
|
|
14
14
|
enumerable: true
|
|
15
15
|
});
|
|
16
16
|
}
|
|
17
|
-
if (
|
|
17
|
+
if (!no_symbols) {
|
|
18
18
|
__defProp(target, Symbol.toStringTag, { value: "Module" });
|
|
19
19
|
}
|
|
20
20
|
return target;
|
package/dist/content/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react from "react";
|
|
2
2
|
import { ReactNode } from "react";
|
|
3
3
|
import { Components } from "hast-util-to-jsx-runtime";
|
|
4
4
|
import { Compatible } from "vfile";
|
|
@@ -17,6 +17,6 @@ declare function Markdown({
|
|
|
17
17
|
remarkPlugins?: PluggableList;
|
|
18
18
|
rehypePlugins?: PluggableList;
|
|
19
19
|
children: Compatible;
|
|
20
|
-
}): Promise<
|
|
20
|
+
}): Promise<react.ReactElement<unknown, string | react.JSXElementConstructor<any>> | Iterable<ReactNode> | (string | number | bigint | boolean | react.ReactPortal | react.ReactElement<unknown, string | react.JSXElementConstructor<any>> | Iterable<ReactNode> | null | undefined)>;
|
|
21
21
|
//#endregion
|
|
22
22
|
export { Markdown, MarkdownProps };
|
|
@@ -1,14 +1,12 @@
|
|
|
1
|
-
import "../../
|
|
2
|
-
import "../../rehype-code.
|
|
3
|
-
import "../../
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import { t as RemarkCodeTabOptions } from "../../remark-code-tab-Bstdspbi.js";
|
|
9
|
-
import { t as RemarkNpmOptions } from "../../remark-npm-BoGbUMH7.js";
|
|
1
|
+
import "../../transformer-icon-D7-6aFzt.js";
|
|
2
|
+
import { RehypeCodeOptions } from "../../mdx-plugins/rehype-code.js";
|
|
3
|
+
import { RemarkImageOptions } from "../../mdx-plugins/remark-image.js";
|
|
4
|
+
import { StructureOptions } from "../../mdx-plugins/remark-structure.js";
|
|
5
|
+
import { RemarkHeadingOptions } from "../../mdx-plugins/remark-heading.js";
|
|
6
|
+
import { RemarkCodeTabOptions } from "../../mdx-plugins/remark-code-tab.js";
|
|
7
|
+
import { RemarkNpmOptions } from "../../mdx-plugins/remark-npm.js";
|
|
10
8
|
import "../../mdx-plugins/index.js";
|
|
11
|
-
import { t as ResolvePlugins } from "../../util-
|
|
9
|
+
import { t as ResolvePlugins } from "../../util-C60LmklF.js";
|
|
12
10
|
import { ProcessorOptions } from "@mdx-js/mdx";
|
|
13
11
|
|
|
14
12
|
//#region src/content/mdx/preset-bundler.d.ts
|
|
@@ -1,14 +1,12 @@
|
|
|
1
|
-
import "../../
|
|
2
|
-
import "../../rehype-code.
|
|
3
|
-
import "../../
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import { t as RemarkCodeTabOptions } from "../../remark-code-tab-Bstdspbi.js";
|
|
9
|
-
import { t as RemarkNpmOptions } from "../../remark-npm-BoGbUMH7.js";
|
|
1
|
+
import "../../transformer-icon-D7-6aFzt.js";
|
|
2
|
+
import { RehypeCodeOptions } from "../../mdx-plugins/rehype-code.js";
|
|
3
|
+
import { RemarkImageOptions } from "../../mdx-plugins/remark-image.js";
|
|
4
|
+
import { StructureOptions } from "../../mdx-plugins/remark-structure.js";
|
|
5
|
+
import { RemarkHeadingOptions } from "../../mdx-plugins/remark-heading.js";
|
|
6
|
+
import { RemarkCodeTabOptions } from "../../mdx-plugins/remark-code-tab.js";
|
|
7
|
+
import { RemarkNpmOptions } from "../../mdx-plugins/remark-npm.js";
|
|
10
8
|
import "../../mdx-plugins/index.js";
|
|
11
|
-
import { t as ResolvePlugins } from "../../util-
|
|
9
|
+
import { t as ResolvePlugins } from "../../util-C60LmklF.js";
|
|
12
10
|
import { ProcessorOptions } from "@mdx-js/mdx";
|
|
13
11
|
|
|
14
12
|
//#region src/content/mdx/preset-runtime.d.ts
|
package/dist/content/toc.d.ts
CHANGED
package/dist/content/toc.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import "../mdast-utils-
|
|
1
|
+
import "../mdast-utils-gJMY143g.js";
|
|
2
2
|
import { remarkHeading } from "../mdx-plugins/remark-heading.js";
|
|
3
3
|
import { remark } from "remark";
|
|
4
4
|
|
|
5
5
|
//#region src/content/toc.ts
|
|
6
6
|
function getTableOfContents(content, remarkPlugins) {
|
|
7
|
-
if (remarkPlugins) return remark().use(remarkPlugins).use(remarkHeading).process(content).then((result
|
|
8
|
-
if ("toc" in result
|
|
7
|
+
if (remarkPlugins) return remark().use(remarkPlugins).use(remarkHeading).process(content).then((result) => {
|
|
8
|
+
if ("toc" in result.data) return result.data.toc;
|
|
9
9
|
return [];
|
|
10
10
|
});
|
|
11
11
|
const result = remark().use(remarkHeading).processSync(content);
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { t as Awaitable } from "./types-BSnJn7kF.js";
|
|
2
|
+
import { I18nConfig } from "./i18n/index.js";
|
|
3
|
+
import { i as LoaderConfig, o as LoaderOutput, u as Page } from "./path-B77y3W0_.js";
|
|
4
|
+
import { AdvancedIndex, AdvancedOptions, Dynamic, Index, SearchAPI, SimpleOptions } from "./search/server.js";
|
|
5
|
+
import { Language, Orama, TypedDocument } from "@orama/orama";
|
|
6
|
+
|
|
7
|
+
//#region src/search/orama/create-db.d.ts
|
|
8
|
+
type SimpleDocument = TypedDocument<Orama<typeof simpleSchema>>;
|
|
9
|
+
declare const simpleSchema: {
|
|
10
|
+
readonly url: "string";
|
|
11
|
+
readonly title: "string";
|
|
12
|
+
readonly breadcrumbs: "string[]";
|
|
13
|
+
readonly description: "string";
|
|
14
|
+
readonly content: "string";
|
|
15
|
+
readonly keywords: "string";
|
|
16
|
+
};
|
|
17
|
+
type AdvancedDocument = TypedDocument<Orama<typeof advancedSchema>>;
|
|
18
|
+
declare const advancedSchema: {
|
|
19
|
+
readonly content: "string";
|
|
20
|
+
readonly page_id: "string";
|
|
21
|
+
readonly type: "string";
|
|
22
|
+
readonly breadcrumbs: "string[]";
|
|
23
|
+
readonly tags: "enum[]";
|
|
24
|
+
readonly url: "string";
|
|
25
|
+
readonly embeddings: "vector[512]";
|
|
26
|
+
};
|
|
27
|
+
//#endregion
|
|
28
|
+
//#region src/search/orama/create-from-source.d.ts
|
|
29
|
+
interface Options<C extends LoaderConfig> extends Omit<AdvancedOptions, 'indexes'> {
|
|
30
|
+
localeMap?: { [K in C['i18n'] extends I18nConfig<infer Languages> ? Languages : string]?: Partial<AdvancedOptions> | Language };
|
|
31
|
+
buildIndex?: (page: Page<C['source']['pageData']>) => Awaitable<AdvancedIndex>;
|
|
32
|
+
}
|
|
33
|
+
declare function createFromSource<C extends LoaderConfig>(source: LoaderOutput<C>, options?: Options<C>): SearchAPI;
|
|
34
|
+
//#endregion
|
|
35
|
+
//#region src/search/orama/create-i18n.d.ts
|
|
36
|
+
type I18nOptions<O extends SimpleOptions | AdvancedOptions, Idx> = Omit<O, 'language' | 'indexes'> & {
|
|
37
|
+
i18n: I18nConfig;
|
|
38
|
+
/**
|
|
39
|
+
* Map locale name from i18n config to Orama compatible `language` or options
|
|
40
|
+
*/
|
|
41
|
+
localeMap?: Record<string, Language | Partial<O> | undefined>;
|
|
42
|
+
indexes: WithLocale<Idx>[] | Dynamic<WithLocale<Idx>>;
|
|
43
|
+
};
|
|
44
|
+
type I18nSimpleOptions = I18nOptions<SimpleOptions, Index>;
|
|
45
|
+
type I18nAdvancedOptions = I18nOptions<AdvancedOptions, AdvancedIndex>;
|
|
46
|
+
type WithLocale<T> = T & {
|
|
47
|
+
locale: string;
|
|
48
|
+
};
|
|
49
|
+
declare function createI18nSearchAPI<T extends 'simple' | 'advanced'>(type: T, options: T extends 'simple' ? I18nSimpleOptions : I18nAdvancedOptions): SearchAPI;
|
|
50
|
+
//#endregion
|
|
51
|
+
export { advancedSchema as a, SimpleDocument as i, createFromSource as n, simpleSchema as o, AdvancedDocument as r, createI18nSearchAPI as t };
|
package/dist/dynamic-link.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { LinkProps } from "./link.js";
|
|
2
|
-
import * as
|
|
2
|
+
import * as react from "react";
|
|
3
3
|
|
|
4
4
|
//#region src/dynamic-link.d.ts
|
|
5
5
|
type DynamicLinkProps = LinkProps;
|
|
@@ -8,6 +8,6 @@ type DynamicLinkProps = LinkProps;
|
|
|
8
8
|
*
|
|
9
9
|
* It supports dynamic hrefs, which means you can use `/[lang]/my-page` with `dynamicHrefs` enabled
|
|
10
10
|
*/
|
|
11
|
-
declare const DynamicLink:
|
|
11
|
+
declare const DynamicLink: react.ForwardRefExoticComponent<LinkProps & react.RefAttributes<HTMLAnchorElement>>;
|
|
12
12
|
//#endregion
|
|
13
13
|
export { DynamicLink, DynamicLink as default, DynamicLinkProps };
|
package/dist/dynamic-link.js
CHANGED
|
@@ -27,7 +27,6 @@ const DynamicLink = forwardRef(({ href, ...props }, ref) => {
|
|
|
27
27
|
});
|
|
28
28
|
});
|
|
29
29
|
DynamicLink.displayName = "DynamicLink";
|
|
30
|
-
var dynamic_link_default = DynamicLink;
|
|
31
30
|
|
|
32
31
|
//#endregion
|
|
33
|
-
export { DynamicLink,
|
|
32
|
+
export { DynamicLink, DynamicLink as default };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ComponentProps, FC, ReactNode } from "react";
|
|
2
|
-
import * as
|
|
2
|
+
import * as react_jsx_runtime0 from "react/jsx-runtime";
|
|
3
3
|
import { StaticImport } from "next/dist/shared/lib/get-img-props";
|
|
4
4
|
|
|
5
5
|
//#region src/framework/index.d.ts
|
|
@@ -39,11 +39,11 @@ declare function FrameworkProvider({
|
|
|
39
39
|
children
|
|
40
40
|
}: Framework & {
|
|
41
41
|
children: ReactNode;
|
|
42
|
-
}):
|
|
42
|
+
}): react_jsx_runtime0.JSX.Element;
|
|
43
43
|
declare function usePathname(): string;
|
|
44
44
|
declare function useRouter(): Router;
|
|
45
45
|
declare function useParams(): Record<string, string | string[]>;
|
|
46
|
-
declare function Image(props: ImageProps):
|
|
47
|
-
declare function Link(props: LinkProps):
|
|
46
|
+
declare function Image(props: ImageProps): react_jsx_runtime0.JSX.Element;
|
|
47
|
+
declare function Link(props: LinkProps): react_jsx_runtime0.JSX.Element;
|
|
48
48
|
//#endregion
|
|
49
49
|
export { Framework, FrameworkProvider, Image, ImageProps, Link, Router, useParams, usePathname, useRouter };
|
package/dist/framework/index.js
CHANGED
|
@@ -12,20 +12,20 @@ const FrameworkContext = createContext({
|
|
|
12
12
|
useRouter: notImplemented,
|
|
13
13
|
usePathname: notImplemented
|
|
14
14
|
});
|
|
15
|
-
function FrameworkProvider({ Link
|
|
15
|
+
function FrameworkProvider({ Link, useRouter, useParams, usePathname, Image, children }) {
|
|
16
16
|
return /* @__PURE__ */ jsx(FrameworkContext, {
|
|
17
17
|
value: useMemo(() => ({
|
|
18
|
-
usePathname
|
|
19
|
-
useRouter
|
|
20
|
-
Link
|
|
21
|
-
Image
|
|
22
|
-
useParams
|
|
18
|
+
usePathname,
|
|
19
|
+
useRouter,
|
|
20
|
+
Link,
|
|
21
|
+
Image,
|
|
22
|
+
useParams
|
|
23
23
|
}), [
|
|
24
|
-
Link
|
|
25
|
-
usePathname
|
|
26
|
-
useRouter
|
|
27
|
-
useParams
|
|
28
|
-
Image
|
|
24
|
+
Link,
|
|
25
|
+
usePathname,
|
|
26
|
+
useRouter,
|
|
27
|
+
useParams,
|
|
28
|
+
Image
|
|
29
29
|
]),
|
|
30
30
|
children
|
|
31
31
|
});
|
|
@@ -40,8 +40,8 @@ function useParams() {
|
|
|
40
40
|
return use(FrameworkContext).useParams();
|
|
41
41
|
}
|
|
42
42
|
function Image(props) {
|
|
43
|
-
const { Image
|
|
44
|
-
if (!Image
|
|
43
|
+
const { Image } = use(FrameworkContext);
|
|
44
|
+
if (!Image) {
|
|
45
45
|
const { src, alt, priority, ...rest } = props;
|
|
46
46
|
return /* @__PURE__ */ jsx("img", {
|
|
47
47
|
alt,
|
|
@@ -50,18 +50,18 @@ function Image(props) {
|
|
|
50
50
|
...rest
|
|
51
51
|
});
|
|
52
52
|
}
|
|
53
|
-
return /* @__PURE__ */ jsx(Image
|
|
53
|
+
return /* @__PURE__ */ jsx(Image, { ...props });
|
|
54
54
|
}
|
|
55
55
|
function Link(props) {
|
|
56
|
-
const { Link
|
|
57
|
-
if (!Link
|
|
56
|
+
const { Link } = use(FrameworkContext);
|
|
57
|
+
if (!Link) {
|
|
58
58
|
const { href, prefetch: _, ...rest } = props;
|
|
59
59
|
return /* @__PURE__ */ jsx("a", {
|
|
60
60
|
href,
|
|
61
61
|
...rest
|
|
62
62
|
});
|
|
63
63
|
}
|
|
64
|
-
return /* @__PURE__ */ jsx(Link
|
|
64
|
+
return /* @__PURE__ */ jsx(Link, { ...props });
|
|
65
65
|
}
|
|
66
66
|
|
|
67
67
|
//#endregion
|
package/dist/framework/next.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Framework } from "./index.js";
|
|
2
2
|
import { ReactNode } from "react";
|
|
3
|
-
import * as
|
|
3
|
+
import * as react_jsx_runtime0 from "react/jsx-runtime";
|
|
4
4
|
|
|
5
5
|
//#region src/framework/next.d.ts
|
|
6
6
|
declare function NextProvider({
|
|
@@ -11,6 +11,6 @@ declare function NextProvider({
|
|
|
11
11
|
children: ReactNode;
|
|
12
12
|
Link?: Framework['Link'];
|
|
13
13
|
Image?: Framework['Image'];
|
|
14
|
-
}):
|
|
14
|
+
}): react_jsx_runtime0.JSX.Element;
|
|
15
15
|
//#endregion
|
|
16
16
|
export { NextProvider };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Framework } from "./index.js";
|
|
2
2
|
import { ReactNode } from "react";
|
|
3
|
-
import * as
|
|
3
|
+
import * as react_jsx_runtime0 from "react/jsx-runtime";
|
|
4
4
|
|
|
5
5
|
//#region src/framework/tanstack.d.ts
|
|
6
6
|
/**
|
|
@@ -14,6 +14,6 @@ declare function TanstackProvider({
|
|
|
14
14
|
children: ReactNode;
|
|
15
15
|
Link?: Framework['Link'];
|
|
16
16
|
Image?: Framework['Image'];
|
|
17
|
-
}):
|
|
17
|
+
}): react_jsx_runtime0.JSX.Element;
|
|
18
18
|
//#endregion
|
|
19
19
|
export { TanstackProvider };
|
package/dist/framework/waku.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Framework } from "./index.js";
|
|
2
2
|
import { ReactNode } from "react";
|
|
3
|
-
import * as
|
|
3
|
+
import * as react_jsx_runtime0 from "react/jsx-runtime";
|
|
4
4
|
|
|
5
5
|
//#region src/framework/waku.d.ts
|
|
6
6
|
declare function WakuProvider({
|
|
@@ -11,6 +11,6 @@ declare function WakuProvider({
|
|
|
11
11
|
children: ReactNode;
|
|
12
12
|
Link?: Framework['Link'];
|
|
13
13
|
Image?: Framework['Image'];
|
|
14
|
-
}):
|
|
14
|
+
}): react_jsx_runtime0.JSX.Element;
|
|
15
15
|
//#endregion
|
|
16
16
|
export { WakuProvider };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
//#region src/mdx-plugins/hast-utils.ts
|
|
2
|
+
/**
|
|
3
|
+
* Visit a node with filtered tag names
|
|
4
|
+
*/
|
|
5
|
+
function visit(node, tagNames, handler) {
|
|
6
|
+
if (node.type === "element" && tagNames.includes(node.tagName)) {
|
|
7
|
+
if (handler(node) === "skip") return;
|
|
8
|
+
}
|
|
9
|
+
if ("children" in node) node.children.forEach((n) => {
|
|
10
|
+
visit(n, tagNames, handler);
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
//#endregion
|
|
15
|
+
export { visit as t };
|
|
@@ -1,10 +1,7 @@
|
|
|
1
|
-
import "../config-DJdZBZlh.js";
|
|
2
|
-
import "../index-D2-6Onl4.js";
|
|
3
1
|
import { HighlightOptions } from "./index.js";
|
|
4
2
|
import { DependencyList, ReactNode } from "react";
|
|
5
3
|
|
|
6
4
|
//#region src/highlight/client.d.ts
|
|
7
|
-
|
|
8
5
|
/**
|
|
9
6
|
* get highlighted results, should be used with React Suspense API.
|
|
10
7
|
*
|
package/dist/highlight/client.js
CHANGED
|
@@ -1,2 +1,15 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { t as Awaitable } from "../types-BSnJn7kF.js";
|
|
2
|
+
import { BundledTheme, CodeOptionsThemes, HighlighterCore } from "shiki";
|
|
3
|
+
|
|
4
|
+
//#region src/highlight/config.d.ts
|
|
5
|
+
interface ShikiConfig {
|
|
6
|
+
createHighlighter: () => Awaitable<HighlighterCore>;
|
|
7
|
+
defaultThemes: CodeOptionsThemes<BundledTheme>;
|
|
8
|
+
}
|
|
9
|
+
interface ResolvedShikiConfig extends ShikiConfig {
|
|
10
|
+
id: symbol;
|
|
11
|
+
}
|
|
12
|
+
/** define shared configurations for Shiki */
|
|
13
|
+
declare function defineShikiConfig(config: ShikiConfig): ResolvedShikiConfig;
|
|
14
|
+
//#endregion
|
|
2
15
|
export { ResolvedShikiConfig, ShikiConfig, defineShikiConfig };
|
package/dist/highlight/config.js
CHANGED
|
@@ -1,3 +1,18 @@
|
|
|
1
|
-
|
|
1
|
+
//#region src/highlight/config.ts
|
|
2
|
+
/** define shared configurations for Shiki */
|
|
3
|
+
function defineShikiConfig(config) {
|
|
4
|
+
let created;
|
|
5
|
+
return {
|
|
6
|
+
id: Symbol(),
|
|
7
|
+
defaultThemes: config.defaultThemes,
|
|
8
|
+
createHighlighter() {
|
|
9
|
+
if (created) return created;
|
|
10
|
+
created = config.createHighlighter();
|
|
11
|
+
if ("then" in created) created = created.then((v) => created = v);
|
|
12
|
+
return created;
|
|
13
|
+
}
|
|
14
|
+
};
|
|
15
|
+
}
|
|
2
16
|
|
|
17
|
+
//#endregion
|
|
3
18
|
export { defineShikiConfig };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { r as MakeOptional } from "../../types-
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { r as MakeOptional } from "../../types-BSnJn7kF.js";
|
|
2
|
+
import { ResolvedShikiConfig } from "../config.js";
|
|
3
|
+
import { CoreHighlightOptions } from "./index.js";
|
|
4
4
|
import { DependencyList, ReactNode } from "react";
|
|
5
|
-
import * as
|
|
5
|
+
import * as react_jsx_runtime0 from "react/jsx-runtime";
|
|
6
6
|
|
|
7
7
|
//#region src/highlight/core/client.d.ts
|
|
8
8
|
declare function useShikiConfigOptional(): ResolvedShikiConfig | null;
|
|
@@ -13,7 +13,7 @@ declare function ShikiConfigProvider({
|
|
|
13
13
|
}: {
|
|
14
14
|
config: ResolvedShikiConfig;
|
|
15
15
|
children: ReactNode;
|
|
16
|
-
}):
|
|
16
|
+
}): react_jsx_runtime0.JSX.Element;
|
|
17
17
|
type UseShikiOptions = MakeOptional<CoreHighlightOptions, 'config'>;
|
|
18
18
|
/**
|
|
19
19
|
* get highlighted results (uncached), use `useEffect` instead of React 19 APIs.
|
|
@@ -1,3 +1,27 @@
|
|
|
1
|
-
import "../../
|
|
2
|
-
import {
|
|
1
|
+
import { n as DistributiveOmit } from "../../types-BSnJn7kF.js";
|
|
2
|
+
import { ResolvedShikiConfig } from "../config.js";
|
|
3
|
+
import { ReactNode } from "react";
|
|
4
|
+
import { Components } from "hast-util-to-jsx-runtime";
|
|
5
|
+
import { BundledLanguage, BundledTheme, CodeOptionsMeta, CodeOptionsThemes, CodeToHastOptionsCommon, HighlighterCore, LanguageRegistration, ThemeRegistrationAny } from "shiki";
|
|
6
|
+
import { Root } from "hast";
|
|
7
|
+
|
|
8
|
+
//#region src/highlight/core/index.d.ts
|
|
9
|
+
type CoreHighlightOptions = CodeToHastOptionsCommon<BundledLanguage> & CodeOptionsMeta & {
|
|
10
|
+
config: ResolvedShikiConfig;
|
|
11
|
+
components?: Partial<Components>;
|
|
12
|
+
fallbackLanguage?: BundledLanguage;
|
|
13
|
+
} & (CodeOptionsThemes<BundledTheme> | Record<never, never>);
|
|
14
|
+
declare function highlightHast(code: string, options: DistributiveOmit<CoreHighlightOptions, 'components'>): Promise<Root>;
|
|
15
|
+
/**
|
|
16
|
+
* Get Shiki highlighter instance of Fumadocs (mostly for internal use, you should use Shiki directly over this).
|
|
17
|
+
*
|
|
18
|
+
* @param engineType - Shiki Regex engine to use.
|
|
19
|
+
* @param options - Shiki options.
|
|
20
|
+
*/
|
|
21
|
+
declare function getHighlighter(config: ResolvedShikiConfig, options?: {
|
|
22
|
+
langs?: (BundledLanguage | LanguageRegistration)[];
|
|
23
|
+
themes?: (BundledTheme | ThemeRegistrationAny)[];
|
|
24
|
+
}): Promise<HighlighterCore>;
|
|
25
|
+
declare function highlight(code: string, options: CoreHighlightOptions): Promise<ReactNode>;
|
|
26
|
+
//#endregion
|
|
3
27
|
export { CoreHighlightOptions, getHighlighter, highlight, highlightHast };
|
|
@@ -1,3 +1,69 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Fragment } from "react";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { toJsxRuntime } from "hast-util-to-jsx-runtime";
|
|
2
4
|
|
|
5
|
+
//#region src/highlight/core/index.ts
|
|
6
|
+
async function highlightHast(code, options) {
|
|
7
|
+
const { fallbackLanguage = "text", config, ...resolved } = options;
|
|
8
|
+
let themesToLoad;
|
|
9
|
+
if (!("theme" in resolved) && !("themes" in resolved)) Object.assign(resolved, config.defaultThemes);
|
|
10
|
+
if ("theme" in resolved) themesToLoad = [resolved.theme];
|
|
11
|
+
else if ("themes" in resolved) {
|
|
12
|
+
themesToLoad = Object.values(resolved.themes).filter((v) => v !== void 0);
|
|
13
|
+
resolved.defaultColor ??= false;
|
|
14
|
+
} else throw new Error("impossible");
|
|
15
|
+
const { isSpecialLang } = await import("shiki/core");
|
|
16
|
+
const highlighter = await config.createHighlighter();
|
|
17
|
+
if (!isSpecialLang(resolved.lang) && !(resolved.lang in highlighter.getBundledLanguages()) && !highlighter.getLoadedLanguages().includes(resolved.lang)) resolved.lang = fallbackLanguage;
|
|
18
|
+
await Promise.all([loadMissingTheme(highlighter, ...themesToLoad), loadMissingLanguage(highlighter, resolved.lang)]);
|
|
19
|
+
return highlighter.codeToHast(code, resolved);
|
|
20
|
+
}
|
|
21
|
+
async function loadMissingTheme(highlighter, ...themes) {
|
|
22
|
+
const { isSpecialTheme } = await import("shiki/core");
|
|
23
|
+
const missingThemes = themes.filter((theme) => {
|
|
24
|
+
if (isSpecialTheme(theme)) return false;
|
|
25
|
+
try {
|
|
26
|
+
highlighter.getTheme(theme);
|
|
27
|
+
return false;
|
|
28
|
+
} catch {
|
|
29
|
+
return true;
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
if (missingThemes.length > 0) await highlighter.loadTheme(...missingThemes);
|
|
33
|
+
}
|
|
34
|
+
async function loadMissingLanguage(highlighter, ...langs) {
|
|
35
|
+
const { isSpecialLang } = await import("shiki/core");
|
|
36
|
+
const missingLangs = langs.filter((lang) => {
|
|
37
|
+
if (isSpecialLang(lang)) return false;
|
|
38
|
+
try {
|
|
39
|
+
highlighter.getLanguage(lang);
|
|
40
|
+
return false;
|
|
41
|
+
} catch {
|
|
42
|
+
return true;
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
if (missingLangs.length > 0) await highlighter.loadLanguage(...missingLangs);
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Get Shiki highlighter instance of Fumadocs (mostly for internal use, you should use Shiki directly over this).
|
|
49
|
+
*
|
|
50
|
+
* @param engineType - Shiki Regex engine to use.
|
|
51
|
+
* @param options - Shiki options.
|
|
52
|
+
*/
|
|
53
|
+
async function getHighlighter(config, options) {
|
|
54
|
+
const highlighter = await config.createHighlighter();
|
|
55
|
+
await Promise.all([options?.langs && loadMissingLanguage(highlighter, ...options.langs), options?.themes && loadMissingTheme(highlighter, ...options.themes)]);
|
|
56
|
+
return highlighter;
|
|
57
|
+
}
|
|
58
|
+
async function highlight(code, options) {
|
|
59
|
+
return toJsxRuntime(await highlightHast(code, options), {
|
|
60
|
+
jsx,
|
|
61
|
+
jsxs,
|
|
62
|
+
development: false,
|
|
63
|
+
Fragment,
|
|
64
|
+
components: options.components
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
//#endregion
|
|
3
69
|
export { getHighlighter, highlight, highlightHast };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { n as DistributiveOmit } from "../types-
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { n as DistributiveOmit } from "../types-BSnJn7kF.js";
|
|
2
|
+
import { ResolvedShikiConfig } from "./config.js";
|
|
3
|
+
import { CoreHighlightOptions } from "./core/index.js";
|
|
4
4
|
import { ReactNode } from "react";
|
|
5
|
-
import * as
|
|
5
|
+
import * as shiki from "shiki";
|
|
6
6
|
import { BundledLanguage, BundledTheme, LanguageRegistration, ThemeRegistrationAny } from "shiki";
|
|
7
7
|
import { Root } from "hast";
|
|
8
8
|
|
|
@@ -25,7 +25,7 @@ declare function highlightHast(code: string, options: HighlightOptions): Promise
|
|
|
25
25
|
declare function getHighlighter(engineType: 'js' | 'oniguruma', options?: {
|
|
26
26
|
langs?: (BundledLanguage | LanguageRegistration)[];
|
|
27
27
|
themes?: (BundledTheme | ThemeRegistrationAny)[];
|
|
28
|
-
}): Promise<
|
|
28
|
+
}): Promise<shiki.HighlighterCore>;
|
|
29
29
|
declare function highlight(code: string, options: HighlightOptions): Promise<ReactNode>;
|
|
30
30
|
declare const configDefault: ResolvedShikiConfig;
|
|
31
31
|
/** config using the WASM powered Regex engine */
|