fumadocs-core 16.11.5 → 16.12.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/breadcrumb.js +1 -1
- package/dist/content/mdx/preset-bundler.d.ts +2 -2
- package/dist/content/mdx/preset-runtime.d.ts +2 -2
- package/dist/content/toc.d.ts +1 -1
- package/dist/framework/waku.js +1 -1
- package/dist/i18n/middleware.js +1 -1
- package/dist/{index-DdWT_FjJ.d.ts → index-CdGTOQQq.d.ts} +1 -1
- package/dist/{index-DmFlQQrd2.d.ts → index-sdv2T3z92.d.ts} +1 -1
- package/dist/{loader-CoSFINvo.js → loader-BxANMvuQ.js} +6 -2
- package/dist/mdx-plugins/index.d.ts +2 -2
- package/dist/mdx-plugins/index.js +1 -1
- package/dist/mdx-plugins/remark-heading.d.ts +1 -1
- package/dist/mdx-plugins/remark-npm.js +75 -1
- package/dist/{remark-heading-BcV2W1fM.d.ts → remark-heading-Dy-3rXdY.d.ts} +1 -1
- package/dist/search/client/fetch.js +2 -2
- package/dist/search/client/flexsearch-static.js +2 -2
- package/dist/search/client/orama-static.js +2 -2
- package/dist/search/flexsearch.d.ts +2 -2
- package/dist/search/mixedbread.d.ts +1 -1
- package/dist/search/orama-cloud-legacy.d.ts +1 -1
- package/dist/search/orama-cloud.d.ts +1 -1
- package/dist/search/server.d.ts +1 -1
- package/dist/{server-B7xEII-W.d.ts → server-gfoj6dyH.d.ts} +1 -1
- package/dist/source/dynamic.d.ts +1 -1
- package/dist/source/dynamic.js +1 -1
- package/dist/source/index.d.ts +1 -1
- package/dist/source/index.js +1 -1
- package/dist/source/llms.d.ts +1 -1
- package/dist/source/plugins/lucide-icons.d.ts +1 -1
- package/dist/source/plugins/slugs.d.ts +1 -1
- package/dist/source/plugins/status-badges.d.ts +1 -1
- package/dist/{toc-17DPqBrN.d.ts → toc-CtW5lwA1.d.ts} +2 -1
- package/dist/toc.d.ts +1 -1
- package/dist/toc.js +18 -13
- package/dist/url-BVHvi3_K.js +29 -0
- package/package.json +11 -12
- package/dist/remark-npm-D9zsrUVt.js +0 -604
- package/dist/url-CWbf4MFh.js +0 -19
package/dist/breadcrumb.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { t as RehypeCodeOptions } from "../../rehype-code-D-RFJb9W.js";
|
|
2
2
|
import { t as RemarkImageOptions } from "../../remark-image-BI2S9LOb.js";
|
|
3
3
|
import { r as StructureOptions } from "../../remark-structure-CnHwvNZr.js";
|
|
4
|
-
import { t as RemarkHeadingOptions } from "../../remark-heading-
|
|
4
|
+
import { t as RemarkHeadingOptions } from "../../remark-heading-Dy-3rXdY.js";
|
|
5
5
|
import { t as RemarkCodeTabOptions } from "../../remark-code-tab-DE_4bdnu.js";
|
|
6
6
|
import { t as RemarkNpmOptions } from "../../remark-npm-BbpvkJaT.js";
|
|
7
|
-
import "../../index-
|
|
7
|
+
import "../../index-CdGTOQQq.js";
|
|
8
8
|
import { t as ResolvePlugins } from "../../util-BDsqOxh3.js";
|
|
9
9
|
import { Pluggable } from "unified";
|
|
10
10
|
import { ProcessorOptions } from "@mdx-js/mdx";
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { t as RehypeCodeOptions } from "../../rehype-code-D-RFJb9W.js";
|
|
2
2
|
import { t as RemarkImageOptions } from "../../remark-image-BI2S9LOb.js";
|
|
3
3
|
import { r as StructureOptions } from "../../remark-structure-CnHwvNZr.js";
|
|
4
|
-
import { t as RemarkHeadingOptions } from "../../remark-heading-
|
|
4
|
+
import { t as RemarkHeadingOptions } from "../../remark-heading-Dy-3rXdY.js";
|
|
5
5
|
import { t as RemarkCodeTabOptions } from "../../remark-code-tab-DE_4bdnu.js";
|
|
6
6
|
import { t as RemarkNpmOptions } from "../../remark-npm-BbpvkJaT.js";
|
|
7
|
-
import "../../index-
|
|
7
|
+
import "../../index-CdGTOQQq.js";
|
|
8
8
|
import { t as ResolvePlugins } from "../../util-BDsqOxh3.js";
|
|
9
9
|
import { ProcessorOptions } from "@mdx-js/mdx";
|
|
10
10
|
//#region src/content/mdx/preset-runtime.d.ts
|
package/dist/content/toc.d.ts
CHANGED
package/dist/framework/waku.js
CHANGED
|
@@ -28,7 +28,7 @@ const framework = {
|
|
|
28
28
|
Link({ href, prefetch = true, ...props }) {
|
|
29
29
|
return /* @__PURE__ */ jsx(Link, {
|
|
30
30
|
to: href,
|
|
31
|
-
unstable_prefetchOnEnter: prefetch,
|
|
31
|
+
unstable_prefetchOnEnter: prefetch ? { mode: "once" } : void 0,
|
|
32
32
|
...props,
|
|
33
33
|
children: props.children
|
|
34
34
|
});
|
package/dist/i18n/middleware.js
CHANGED
|
@@ -56,7 +56,7 @@ const cacheDefault = { create: function create() {
|
|
|
56
56
|
return new ObjectWithoutPrototypeCache();
|
|
57
57
|
} };
|
|
58
58
|
//#endregion
|
|
59
|
-
//#region ../../node_modules/.pnpm/@formatjs+intl-localematcher@0.8.
|
|
59
|
+
//#region ../../node_modules/.pnpm/@formatjs+intl-localematcher@0.8.13/node_modules/@formatjs/intl-localematcher/index.js
|
|
60
60
|
/**
|
|
61
61
|
* http://ecma-international.org/ecma-402/7.0/index.html#sec-canonicalizelocalelist
|
|
62
62
|
* @param locales
|
|
@@ -2,7 +2,7 @@ import "./remark-gfm-DpVfAX1x.js";
|
|
|
2
2
|
import "./rehype-code-D-RFJb9W.js";
|
|
3
3
|
import "./remark-image-BI2S9LOb.js";
|
|
4
4
|
import "./remark-structure-CnHwvNZr.js";
|
|
5
|
-
import "./remark-heading-
|
|
5
|
+
import "./remark-heading-Dy-3rXdY.js";
|
|
6
6
|
import "./remark-admonition-BwTcmI_S.js";
|
|
7
7
|
import "./remark-directive-admonition-BLiJ5l43.js";
|
|
8
8
|
import "./rehype-toc-K51AGb5U.js";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { a as Separator, i as Root, n as Item, r as Node, t as Folder } from "./definitions-D8-KI7Uy.js";
|
|
2
2
|
import { t as Awaitable } from "./types-D89QoQR-.js";
|
|
3
3
|
import { i as StructuredData } from "./remark-structure-CnHwvNZr.js";
|
|
4
|
-
import "./index-
|
|
4
|
+
import "./index-CdGTOQQq.js";
|
|
5
5
|
import { n as I18nConfig } from "./index-DydiXvgS.js";
|
|
6
6
|
import "./index-DZN5OrTa.js";
|
|
7
7
|
import { n as SerializedPageTree } from "./index-CdZGMKDG.js";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { r as normalizeUrl } from "./url-BVHvi3_K.js";
|
|
2
2
|
import { c as visit } from "./utils-Dn9VIXRN.js";
|
|
3
3
|
import { a as normalize, i as joinPath, n as dirname, r as extname, t as basename } from "./path-B9zu5SjE.js";
|
|
4
4
|
import { slugsPlugin } from "./source/plugins/slugs.js";
|
|
@@ -695,7 +695,11 @@ function loader(...args) {
|
|
|
695
695
|
const [value, hash] = href.split("#", 2);
|
|
696
696
|
let target;
|
|
697
697
|
if (value.startsWith("./") || value.startsWith("../")) {
|
|
698
|
-
|
|
698
|
+
let decoded = value;
|
|
699
|
+
try {
|
|
700
|
+
decoded = decodeURI(value);
|
|
701
|
+
} catch {}
|
|
702
|
+
const path = joinPath(dir, decoded);
|
|
699
703
|
target = indexer.getPage(path, language);
|
|
700
704
|
} else target = this.getPages(language).find((item) => item.url === value);
|
|
701
705
|
if (target) return {
|
|
@@ -4,7 +4,7 @@ import { r as transformerIcon, t as CodeBlockIcon } from "../transformer-icon-Dl
|
|
|
4
4
|
import { n as rehypeCode, r as rehypeCodeDefaultOptions, t as RehypeCodeOptions } from "../rehype-code-D-RFJb9W.js";
|
|
5
5
|
import { n as remarkImage, t as RemarkImageOptions } from "../remark-image-BI2S9LOb.js";
|
|
6
6
|
import { a as defaultStringifier, c as structure, i as StructuredData, n as StringifyOptions, o as remarkStructure, r as StructureOptions, s as remarkStructureDefaultOptions, t as Stringifier } from "../remark-structure-CnHwvNZr.js";
|
|
7
|
-
import { n as remarkHeading, t as RemarkHeadingOptions } from "../remark-heading-
|
|
7
|
+
import { n as remarkHeading, t as RemarkHeadingOptions } from "../remark-heading-Dy-3rXdY.js";
|
|
8
8
|
import { n as remarkAdmonition, t as RemarkAdmonitionOptions } from "../remark-admonition-BwTcmI_S.js";
|
|
9
9
|
import { n as remarkDirectiveAdmonition, t as RemarkDirectiveAdmonitionOptions } from "../remark-directive-admonition-BLiJ5l43.js";
|
|
10
10
|
import { n as RehypeTocOptions, r as rehypeToc, t as RehypeTOCItemType } from "../rehype-toc-K51AGb5U.js";
|
|
@@ -16,5 +16,5 @@ import { a as remarkMdxFiles, r as RemarkMdxFilesOptions } from "../remark-mdx-f
|
|
|
16
16
|
import { n as remarkMdxMermaid, t as RemarkMdxMermaidOptions } from "../remark-mdx-mermaid-C1bCHHc6.js";
|
|
17
17
|
import { n as RemarkFeedbackBlockOptions, r as remarkFeedbackBlock, t as FeedbackBlockProps } from "../remark-feedback-block-BxtINXN-.js";
|
|
18
18
|
import { t as LLMsOptions } from "../remark-llms-BF5SHW_O.js";
|
|
19
|
-
import "../index-
|
|
19
|
+
import "../index-CdGTOQQq.js";
|
|
20
20
|
export { CodeBlockAttributes, type CodeBlockIcon, CodeBlockTabsOptions, FeedbackBlockProps, type LLMsOptions, RehypeCodeOptions, RehypeTOCItemType, RehypeTocOptions, RemarkAdmonitionOptions, RemarkCodeTabOptions, RemarkDirectiveAdmonitionOptions, RemarkFeedbackBlockOptions, type RemarkGfmOptions, RemarkHeadingOptions, RemarkImageOptions, type RemarkMdxFilesOptions, RemarkMdxMermaidOptions, RemarkNpmOptions, RemarkStepsOptions, Stringifier, StringifyOptions, StructureOptions, StructuredData, defaultStringifier, generateCodeBlockTabs, parseCodeBlockAttributes, rehypeCode, rehypeCodeDefaultOptions, rehypeToc, remarkAdmonition, remarkCodeTab, remarkDirectiveAdmonition, remarkFeedbackBlock, remarkGfm, remarkHeading, remarkImage, remarkMdxFiles, remarkMdxMermaid, remarkNpm, remarkSteps, remarkStructure, remarkStructureDefaultOptions, structure, transformerIcon, transformerTab };
|
|
@@ -11,7 +11,7 @@ import { remarkDirectiveAdmonition } from "./remark-directive-admonition.js";
|
|
|
11
11
|
import { rehypeToc } from "./rehype-toc.js";
|
|
12
12
|
import { remarkCodeTab } from "./remark-code-tab.js";
|
|
13
13
|
import { remarkSteps } from "./remark-steps.js";
|
|
14
|
-
import {
|
|
14
|
+
import { remarkNpm } from "./remark-npm.js";
|
|
15
15
|
import { remarkMdxFiles } from "./remark-mdx-files.js";
|
|
16
16
|
import { remarkMdxMermaid } from "./remark-mdx-mermaid.js";
|
|
17
17
|
import { remarkFeedbackBlock } from "./remark-feedback-block.js";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as remarkHeading, t as RemarkHeadingOptions } from "../remark-heading-
|
|
1
|
+
import { n as remarkHeading, t as RemarkHeadingOptions } from "../remark-heading-Dy-3rXdY.js";
|
|
2
2
|
export { RemarkHeadingOptions, remarkHeading };
|
|
@@ -1,2 +1,76 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { generateCodeBlockTabs } from "./codeblock-utils.js";
|
|
2
|
+
import { visit } from "unist-util-visit";
|
|
3
|
+
import convert from "npm-to-yarn";
|
|
4
|
+
//#region src/mdx-plugins/remark-npm.ts
|
|
5
|
+
function convertLines(cmd, to) {
|
|
6
|
+
return cmd.split("\n").map((l) => convert(l, to)).join("\n");
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* It generates multiple tabs of codeblocks for different package managers from a npm command codeblock.
|
|
10
|
+
*/
|
|
11
|
+
function remarkNpm({ persist = false, packageManagers = [
|
|
12
|
+
{
|
|
13
|
+
command: (cmd) => cmd,
|
|
14
|
+
name: "npm"
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
command: (cmd) => convertLines(cmd, "pnpm"),
|
|
18
|
+
name: "pnpm"
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
command: (cmd) => convertLines(cmd, "yarn"),
|
|
22
|
+
name: "yarn"
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
command: (cmd) => convertLines(cmd, "bun"),
|
|
26
|
+
name: "bun"
|
|
27
|
+
}
|
|
28
|
+
] } = {}) {
|
|
29
|
+
return (tree) => {
|
|
30
|
+
visit(tree, "code", (node, idx, parent) => {
|
|
31
|
+
if (typeof idx !== "number" || !parent) return;
|
|
32
|
+
let code;
|
|
33
|
+
switch (node.lang) {
|
|
34
|
+
case "package-install":
|
|
35
|
+
code = node.value;
|
|
36
|
+
if (!code.startsWith("npm") && !code.startsWith("npx")) code = `npm install ${code}`;
|
|
37
|
+
break;
|
|
38
|
+
case "npm":
|
|
39
|
+
code = node.value;
|
|
40
|
+
break;
|
|
41
|
+
default: return;
|
|
42
|
+
}
|
|
43
|
+
const options = {
|
|
44
|
+
persist,
|
|
45
|
+
tabs: [],
|
|
46
|
+
triggers: []
|
|
47
|
+
};
|
|
48
|
+
for (const manager of packageManagers) {
|
|
49
|
+
const value = manager.value ?? manager.name;
|
|
50
|
+
const command = manager.command(code);
|
|
51
|
+
if (!command || command.length === 0) continue;
|
|
52
|
+
options.defaultValue ??= value;
|
|
53
|
+
options.triggers.push({
|
|
54
|
+
value,
|
|
55
|
+
children: [{
|
|
56
|
+
type: "text",
|
|
57
|
+
value: manager.name
|
|
58
|
+
}]
|
|
59
|
+
});
|
|
60
|
+
options.tabs.push({
|
|
61
|
+
value,
|
|
62
|
+
children: [{
|
|
63
|
+
type: "code",
|
|
64
|
+
lang: "bash",
|
|
65
|
+
meta: node.meta,
|
|
66
|
+
value: command
|
|
67
|
+
}]
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
parent.children[idx] = generateCodeBlockTabs(options);
|
|
71
|
+
return "skip";
|
|
72
|
+
});
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
//#endregion
|
|
2
76
|
export { remarkNpm };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { t as BASE_PATH } from "../../url-
|
|
1
|
+
import { n as join, t as BASE_PATH } from "../../url-BVHvi3_K.js";
|
|
2
2
|
//#region src/search/client/fetch.ts
|
|
3
3
|
const globalCache = /* @__PURE__ */ new Map();
|
|
4
|
-
function fetchClient({ api =
|
|
4
|
+
function fetchClient({ api = join(BASE_PATH, "/api/search"), locale, tag, cache = globalCache } = {}) {
|
|
5
5
|
return {
|
|
6
6
|
deps: [
|
|
7
7
|
api,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as BASE_PATH } from "../../url-
|
|
1
|
+
import { n as join, t as BASE_PATH } from "../../url-BVHvi3_K.js";
|
|
2
2
|
import { n as search, t as createDocument } from "../../utils-Bvy3V-fv.js";
|
|
3
3
|
//#region src/search/client/flexsearch-static.ts
|
|
4
4
|
function initDocument(data) {
|
|
@@ -8,7 +8,7 @@ function initDocument(data) {
|
|
|
8
8
|
}
|
|
9
9
|
const cacheMap = /* @__PURE__ */ new Map();
|
|
10
10
|
function flexsearchStaticClient(options = {}) {
|
|
11
|
-
const { from =
|
|
11
|
+
const { from = join(BASE_PATH, "/api/search"), locale = "", tag } = options;
|
|
12
12
|
let dbs = cacheMap.get(from);
|
|
13
13
|
if (!dbs && typeof window !== "undefined") {
|
|
14
14
|
dbs = init(from);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as BASE_PATH } from "../../url-
|
|
1
|
+
import { n as join, t as BASE_PATH } from "../../url-BVHvi3_K.js";
|
|
2
2
|
import { n as searchSimple, t as searchAdvanced } from "../../advanced-BnqbPavQ.js";
|
|
3
3
|
import { create, load } from "@orama/orama";
|
|
4
4
|
//#region src/search/client/orama-static.ts
|
|
@@ -29,7 +29,7 @@ async function loadDB(from, initOrama = (locale) => create({
|
|
|
29
29
|
}
|
|
30
30
|
return dbs;
|
|
31
31
|
}
|
|
32
|
-
function getDBCached({ from =
|
|
32
|
+
function getDBCached({ from = join(BASE_PATH, "/api/search"), initOrama }) {
|
|
33
33
|
const cacheKey = from;
|
|
34
34
|
const cached = cache.get(cacheKey);
|
|
35
35
|
if (cached) return cached;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { t as Awaitable } from "../types-D89QoQR-.js";
|
|
2
2
|
import { n as I18nConfig } from "../index-DydiXvgS.js";
|
|
3
3
|
import "../index-BM36H-xw.js";
|
|
4
|
-
import { m as SharedIndex, n as SearchAPI, t as QueryOptions } from "../server-
|
|
5
|
-
import { x as LoaderOutput, y as LoaderConfig } from "../index-
|
|
4
|
+
import { m as SharedIndex, n as SearchAPI, t as QueryOptions } from "../server-gfoj6dyH.js";
|
|
5
|
+
import { x as LoaderOutput, y as LoaderConfig } from "../index-sdv2T3z92.js";
|
|
6
6
|
import { DocumentData, DocumentOptions } from "flexsearch";
|
|
7
7
|
//#region src/search/server/build-doc.d.ts
|
|
8
8
|
interface SharedDocument {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { r as SortedResult } from "../index-BM36H-xw.js";
|
|
2
|
-
import { n as SearchAPI } from "../server-
|
|
2
|
+
import { n as SearchAPI } from "../server-gfoj6dyH.js";
|
|
3
3
|
import Mixedbread from "@mixedbread/sdk";
|
|
4
4
|
import { StoreSearchResponse } from "@mixedbread/sdk/resources/stores";
|
|
5
5
|
//#region src/search/mixedbread.d.ts
|
package/dist/search/server.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as AdvancedOptions, c as SimpleOptions, d as createSearchAPI, f as initAdvancedSearch, i as AdvancedIndex, l as createFromSource, n as SearchAPI, o as ExportedData, p as initSimpleSearch, r as SearchServer, s as Index, t as QueryOptions, u as createI18nSearchAPI } from "../server-
|
|
1
|
+
import { a as AdvancedOptions, c as SimpleOptions, d as createSearchAPI, f as initAdvancedSearch, i as AdvancedIndex, l as createFromSource, n as SearchAPI, o as ExportedData, p as initSimpleSearch, r as SearchServer, s as Index, t as QueryOptions, u as createI18nSearchAPI } from "../server-gfoj6dyH.js";
|
|
2
2
|
export { AdvancedIndex, AdvancedOptions, ExportedData, Index, QueryOptions, SearchAPI, SearchServer, SimpleOptions, createFromSource, createI18nSearchAPI, createSearchAPI, initAdvancedSearch, initSimpleSearch };
|
|
@@ -2,7 +2,7 @@ import { t as Awaitable } from "./types-D89QoQR-.js";
|
|
|
2
2
|
import { i as StructuredData } from "./remark-structure-CnHwvNZr.js";
|
|
3
3
|
import { n as I18nConfig } from "./index-DydiXvgS.js";
|
|
4
4
|
import { r as SortedResult } from "./index-BM36H-xw.js";
|
|
5
|
-
import { x as LoaderOutput, y as LoaderConfig } from "./index-
|
|
5
|
+
import { x as LoaderOutput, y as LoaderConfig } from "./index-sdv2T3z92.js";
|
|
6
6
|
import { Language, Orama, RawData, SearchParams, TypedDocument, create } from "@orama/orama";
|
|
7
7
|
//#region src/search/orama/create-db.d.ts
|
|
8
8
|
type SimpleDocument = TypedDocument<Orama<typeof simpleSchema>>;
|
package/dist/source/dynamic.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { g as dynamicLoader, h as DynamicLoaderConfig, m as DynamicLoader } from "../index-
|
|
1
|
+
import { g as dynamicLoader, h as DynamicLoaderConfig, m as DynamicLoader } from "../index-sdv2T3z92.js";
|
|
2
2
|
export { DynamicLoader, DynamicLoaderConfig, dynamicLoader };
|
package/dist/source/dynamic.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { i as isStaticSource, n as loader, r as isDynamicSource } from "../loader-
|
|
1
|
+
import { i as isStaticSource, n as loader, r as isDynamicSource } from "../loader-BxANMvuQ.js";
|
|
2
2
|
import { cache } from "react";
|
|
3
3
|
//#region src/source/dynamic.ts
|
|
4
4
|
function dynamicLoader(input, options) {
|
package/dist/source/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { B as ContentStoragePageFile, C as LoaderPluginOption, D as createGetUrl, E as ResolvedLoaderConfig, F as PageTreeBuilderContext, I as PageTreeOptions, L as PageTreeTransformer, O as loader, P as PageTreeBuilder, R as ContentStorage, S as LoaderPlugin, T as Page, V as FileSystem, _ as InferMetaType, a as MetaData, b as LoaderOptions, c as SourceUnion, d as multiple, f as source, i as DynamicSource, j as getSlugs, k as types_d_exports, l as StaticSource, n as llms, o as PageData, p as update, r as path_d_exports, s as Source, t as LLMsConfig, u as VirtualFile, v as InferPageType, w as Meta, x as LoaderOutput, y as LoaderConfig, z as ContentStorageMetaFile } from "../index-
|
|
1
|
+
import { B as ContentStoragePageFile, C as LoaderPluginOption, D as createGetUrl, E as ResolvedLoaderConfig, F as PageTreeBuilderContext, I as PageTreeOptions, L as PageTreeTransformer, O as loader, P as PageTreeBuilder, R as ContentStorage, S as LoaderPlugin, T as Page, V as FileSystem, _ as InferMetaType, a as MetaData, b as LoaderOptions, c as SourceUnion, d as multiple, f as source, i as DynamicSource, j as getSlugs, k as types_d_exports, l as StaticSource, n as llms, o as PageData, p as update, r as path_d_exports, s as Source, t as LLMsConfig, u as VirtualFile, v as InferPageType, w as Meta, x as LoaderOutput, y as LoaderConfig, z as ContentStorageMetaFile } from "../index-sdv2T3z92.js";
|
|
2
2
|
export { type ContentStorage, type ContentStorageMetaFile, type ContentStoragePageFile, type DynamicSource, FileSystem, InferMetaType, InferPageType, LLMsConfig, LoaderConfig, LoaderOptions, LoaderOutput, LoaderPlugin, LoaderPluginOption, Meta, type MetaData, Page, type PageData, type PageTreeBuilder, type PageTreeBuilderContext, type PageTreeOptions, type PageTreeTransformer, path_d_exports as PathUtils, ResolvedLoaderConfig, type Source, type SourceUnion, type StaticSource, type VirtualFile, type types_d_exports as _Internal, createGetUrl, getSlugs, llms, loader, multiple, source, update };
|
package/dist/source/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { o as path_exports } from "../path-B9zu5SjE.js";
|
|
2
|
-
import { a as multiple, c as FileSystem, n as loader, o as source, s as update, t as createGetUrl } from "../loader-
|
|
2
|
+
import { a as multiple, c as FileSystem, n as loader, o as source, s as update, t as createGetUrl } from "../loader-BxANMvuQ.js";
|
|
3
3
|
import { getSlugs } from "./plugins/slugs.js";
|
|
4
4
|
import { llms } from "./llms.js";
|
|
5
5
|
export { FileSystem, path_exports as PathUtils, createGetUrl, getSlugs, llms, loader, multiple, source, update };
|
package/dist/source/llms.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as llms, t as LLMsConfig } from "../index-
|
|
1
|
+
import { n as llms, t as LLMsConfig } from "../index-sdv2T3z92.js";
|
|
2
2
|
export { LLMsConfig, llms };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { A as SlugFn, M as slugsFromData, N as slugsPlugin, j as getSlugs } from "../../index-
|
|
1
|
+
import { A as SlugFn, M as slugsFromData, N as slugsPlugin, j as getSlugs } from "../../index-sdv2T3z92.js";
|
|
2
2
|
export { SlugFn, getSlugs, slugsFromData, slugsPlugin };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { a as Separator$1, n as Item$1, t as Folder$1 } from "../../definitions-D8-KI7Uy.js";
|
|
2
|
-
import { S as LoaderPlugin } from "../../index-
|
|
2
|
+
import { S as LoaderPlugin } from "../../index-sdv2T3z92.js";
|
|
3
3
|
import { ReactNode } from "react";
|
|
4
4
|
//#region src/source/plugins/status-badges.d.ts
|
|
5
5
|
interface Item extends Item$1 {
|
|
@@ -38,9 +38,10 @@ interface ScrollProviderProps {
|
|
|
38
38
|
declare function ScrollProvider({ containerRef, children }: ScrollProviderProps): import("react").JSX.Element;
|
|
39
39
|
declare function AnchorProvider({ toc, single, children }: AnchorProviderProps): import("react").JSX.Element;
|
|
40
40
|
interface TOCItemProps extends ComponentProps<'a'> {
|
|
41
|
+
autoScroll?: boolean;
|
|
41
42
|
onActiveChange?: (v: boolean) => void;
|
|
42
43
|
}
|
|
43
|
-
declare function TOCItem({ ref, onActiveChange, ...props }: TOCItemProps): import("react").JSX.Element;
|
|
44
|
+
declare function TOCItem({ ref, onActiveChange, autoScroll, ...props }: TOCItemProps): import("react").JSX.Element;
|
|
44
45
|
/** @returns static info object, useful for custom rendering logic */
|
|
45
46
|
declare function useTOC(): {
|
|
46
47
|
get(): TOCItemInfo[];
|
package/dist/toc.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as TOCItem, c as TOCItemType, d as useActiveAnchors, f as useItems, h as useTOCSelector, i as ScrollProviderProps, l as TableOfContents, m as useTOCListener, n as AnchorProviderProps, o as TOCItemInfo, p as useTOC, r as ScrollProvider, s as TOCItemProps, t as AnchorProvider, u as useActiveAnchor } from "./toc-
|
|
1
|
+
import { a as TOCItem, c as TOCItemType, d as useActiveAnchors, f as useItems, h as useTOCSelector, i as ScrollProviderProps, l as TableOfContents, m as useTOCListener, n as AnchorProviderProps, o as TOCItemInfo, p as useTOC, r as ScrollProvider, s as TOCItemProps, t as AnchorProvider, u as useActiveAnchor } from "./toc-CtW5lwA1.js";
|
|
2
2
|
export { AnchorProvider, AnchorProviderProps, ScrollProvider, ScrollProviderProps, TOCItem, TOCItemInfo, TOCItemProps, TOCItemType, TableOfContents, useActiveAnchor, useActiveAnchors, useItems, useTOC, useTOCListener, useTOCSelector };
|
package/dist/toc.js
CHANGED
|
@@ -38,39 +38,44 @@ function AnchorProvider({ toc, single = false, children }) {
|
|
|
38
38
|
children
|
|
39
39
|
});
|
|
40
40
|
}
|
|
41
|
-
function TOCItem({ ref, onActiveChange = () => null, ...props }) {
|
|
41
|
+
function TOCItem({ ref, onActiveChange = () => null, autoScroll = true, ...props }) {
|
|
42
42
|
const id = props.href ? getItemId(props.href) : null;
|
|
43
43
|
const containerRef = use(ScrollContext);
|
|
44
44
|
const anchorRef = useRef(null);
|
|
45
|
+
const isInitialRef = useRef(true);
|
|
45
46
|
const observer = useObserver();
|
|
46
47
|
const [active, setActive] = useState(() => observer.items.some((item) => item.id === id && item.active));
|
|
47
|
-
|
|
48
|
+
const onUpdate = useEffectEvent((items, initial) => {
|
|
49
|
+
const itemData = id ? items.find((item) => item.id === id) : null;
|
|
50
|
+
if (!itemData) return;
|
|
51
|
+
if (itemData.active !== active) {
|
|
52
|
+
setActive(itemData.active);
|
|
53
|
+
onActiveChange(itemData.active);
|
|
54
|
+
}
|
|
48
55
|
const anchor = anchorRef.current;
|
|
49
56
|
const container = containerRef?.current;
|
|
50
|
-
if (!
|
|
57
|
+
if (!autoScroll || !anchor || !container) return;
|
|
51
58
|
let lastActive;
|
|
52
59
|
for (const item of items) {
|
|
53
60
|
if (!item.active) continue;
|
|
54
61
|
if (!lastActive || lastActive.t < item.t) lastActive = item;
|
|
55
62
|
}
|
|
56
63
|
if (lastActive?.id === id) scrollIntoView(anchor, {
|
|
57
|
-
behavior:
|
|
64
|
+
behavior: initial ? "instant" : "smooth",
|
|
58
65
|
block: "center",
|
|
59
66
|
inline: "center",
|
|
60
67
|
scrollMode: "always",
|
|
61
68
|
boundary: container
|
|
62
69
|
});
|
|
63
|
-
}
|
|
64
|
-
useTOCListener((items) => {
|
|
65
|
-
const itemData = id ? items.find((item) => item.id === id) : null;
|
|
66
|
-
if (itemData && itemData.active !== active) {
|
|
67
|
-
setActive(itemData.active);
|
|
68
|
-
onActiveChange(itemData.active);
|
|
69
|
-
autoScroll(items);
|
|
70
|
-
}
|
|
71
70
|
});
|
|
72
71
|
useEffect(() => {
|
|
73
|
-
autoScroll(observer.items,
|
|
72
|
+
if (autoScroll) onUpdate(observer.items, isInitialRef.current);
|
|
73
|
+
isInitialRef.current = false;
|
|
74
|
+
}, [observer, autoScroll]);
|
|
75
|
+
useEffect(() => {
|
|
76
|
+
const listener = (items) => onUpdate(items, false);
|
|
77
|
+
observer.listen(listener);
|
|
78
|
+
return () => observer.unlisten(listener);
|
|
74
79
|
}, [observer]);
|
|
75
80
|
return /* @__PURE__ */ jsx("a", {
|
|
76
81
|
ref: mergeRefs(anchorRef, ref),
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
//#region src/utils/url.tsx
|
|
2
|
+
/**
|
|
3
|
+
* The base path (Vite)
|
|
4
|
+
*/
|
|
5
|
+
const BASE_PATH = typeof import.meta.env !== "undefined" && typeof import.meta.env.BASE_URL === "string" ? import.meta.env.BASE_URL : "/";
|
|
6
|
+
function join(...paths) {
|
|
7
|
+
let out = "";
|
|
8
|
+
for (let p of paths) {
|
|
9
|
+
if (out.length > 0) {
|
|
10
|
+
if (p.startsWith("/")) p = p.slice(1);
|
|
11
|
+
if (!out.endsWith("/")) out += "/";
|
|
12
|
+
}
|
|
13
|
+
out += p;
|
|
14
|
+
}
|
|
15
|
+
return out;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* normalize URL into the Fumadocs standard form (`/slug-1/slug-2`).
|
|
19
|
+
*
|
|
20
|
+
* This includes URLs with trailing slashes.
|
|
21
|
+
*/
|
|
22
|
+
function normalizeUrl(url) {
|
|
23
|
+
if (url.startsWith("http://") || url.startsWith("https://")) return url;
|
|
24
|
+
if (!url.startsWith("/")) url = "/" + url;
|
|
25
|
+
if (url.length > 1 && url.endsWith("/")) url = url.slice(0, -1);
|
|
26
|
+
return url;
|
|
27
|
+
}
|
|
28
|
+
//#endregion
|
|
29
|
+
export { join as n, normalizeUrl as r, BASE_PATH as t };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "fumadocs-core",
|
|
3
|
-
"version": "16.
|
|
3
|
+
"version": "16.12.1",
|
|
4
4
|
"description": "The React.js library for building a documentation website",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"Docs",
|
|
@@ -110,6 +110,7 @@
|
|
|
110
110
|
"hast-util-to-jsx-runtime": "^2.3.6",
|
|
111
111
|
"mdast-util-mdx": "^3.0.0",
|
|
112
112
|
"mdast-util-to-markdown": "^2.1.2",
|
|
113
|
+
"npm-to-yarn": "3.1.0",
|
|
113
114
|
"remark": "^15.0.1",
|
|
114
115
|
"remark-gfm": "^4.0.1",
|
|
115
116
|
"remark-rehype": "^11.1.2",
|
|
@@ -122,13 +123,13 @@
|
|
|
122
123
|
"yaml": "^2.9.0"
|
|
123
124
|
},
|
|
124
125
|
"devDependencies": {
|
|
125
|
-
"@formatjs/intl-localematcher": "^0.8.
|
|
126
|
+
"@formatjs/intl-localematcher": "^0.8.13",
|
|
126
127
|
"@mdx-js/mdx": "^3.1.1",
|
|
127
128
|
"@mixedbread/sdk": "0.77.0",
|
|
128
129
|
"@orama/core": "^1.2.19",
|
|
129
130
|
"@oramacloud/client": "^2.1.4",
|
|
130
131
|
"@shikijs/transformers": "^4.3.1",
|
|
131
|
-
"@tanstack/react-router": "1.170.
|
|
132
|
+
"@tanstack/react-router": "1.170.18",
|
|
132
133
|
"@types/estree-jsx": "^1.0.5",
|
|
133
134
|
"@types/hast": "^3.0.5",
|
|
134
135
|
"@types/mdast": "^4.0.4",
|
|
@@ -136,21 +137,20 @@
|
|
|
136
137
|
"@types/node": "26.1.1",
|
|
137
138
|
"@types/react": "^19.2.17",
|
|
138
139
|
"@types/react-dom": "^19.2.3",
|
|
139
|
-
"algoliasearch": "5.
|
|
140
|
+
"algoliasearch": "5.56.0",
|
|
140
141
|
"flexsearch": "^0.8.212",
|
|
141
142
|
"image-size": "^2.0.2",
|
|
142
|
-
"lucide-react": "^1.
|
|
143
|
+
"lucide-react": "^1.25.0",
|
|
143
144
|
"negotiator": "^1.0.0",
|
|
144
|
-
"next": "16.2.
|
|
145
|
-
"npm-to-yarn": "^3.0.1",
|
|
145
|
+
"next": "16.2.11",
|
|
146
146
|
"path-to-regexp": "^8.4.2",
|
|
147
|
-
"react-router": "^8.
|
|
147
|
+
"react-router": "^8.3.0",
|
|
148
148
|
"remark-directive": "^4.0.0",
|
|
149
149
|
"remark-mdx": "^3.1.1",
|
|
150
150
|
"remove-markdown": "^0.6.4",
|
|
151
|
-
"tsdown": "0.22.
|
|
151
|
+
"tsdown": "0.22.13",
|
|
152
152
|
"typescript": "^6.0.3",
|
|
153
|
-
"waku": "1.0.0-beta.
|
|
153
|
+
"waku": "1.0.0-beta.7",
|
|
154
154
|
"zod": "4.4.3",
|
|
155
155
|
"tsconfig": "0.0.0"
|
|
156
156
|
},
|
|
@@ -232,11 +232,10 @@
|
|
|
232
232
|
},
|
|
233
233
|
"inlinedDependencies": {
|
|
234
234
|
"@formatjs/fast-memoize": "3.1.7",
|
|
235
|
-
"@formatjs/intl-localematcher": "0.8.
|
|
235
|
+
"@formatjs/intl-localematcher": "0.8.13",
|
|
236
236
|
"@shikijs/transformers": "4.3.1",
|
|
237
237
|
"image-size": "2.0.2",
|
|
238
238
|
"negotiator": "1.0.0",
|
|
239
|
-
"npm-to-yarn": "3.0.1",
|
|
240
239
|
"path-to-regexp": "8.4.2",
|
|
241
240
|
"remove-markdown": "0.6.4"
|
|
242
241
|
},
|
|
@@ -1,604 +0,0 @@
|
|
|
1
|
-
import { generateCodeBlockTabs } from "./mdx-plugins/codeblock-utils.js";
|
|
2
|
-
import { visit } from "unist-util-visit";
|
|
3
|
-
//#region ../../node_modules/.pnpm/npm-to-yarn@3.0.1/node_modules/npm-to-yarn/dist/npm-to-yarn.mjs
|
|
4
|
-
var unchangedCLICommands = [
|
|
5
|
-
"test",
|
|
6
|
-
"login",
|
|
7
|
-
"logout",
|
|
8
|
-
"link",
|
|
9
|
-
"unlink",
|
|
10
|
-
"publish",
|
|
11
|
-
"cache",
|
|
12
|
-
"start",
|
|
13
|
-
"stop",
|
|
14
|
-
"test"
|
|
15
|
-
];
|
|
16
|
-
var yarnCLICommands = [
|
|
17
|
-
"init",
|
|
18
|
-
"run",
|
|
19
|
-
"add",
|
|
20
|
-
"audit",
|
|
21
|
-
"autoclean",
|
|
22
|
-
"bin",
|
|
23
|
-
"check",
|
|
24
|
-
"config",
|
|
25
|
-
"create",
|
|
26
|
-
"dedupe",
|
|
27
|
-
"generate-lock-entry",
|
|
28
|
-
"global",
|
|
29
|
-
"help",
|
|
30
|
-
"import",
|
|
31
|
-
"info",
|
|
32
|
-
"install",
|
|
33
|
-
"licenses",
|
|
34
|
-
"list",
|
|
35
|
-
"lockfile",
|
|
36
|
-
"outdated",
|
|
37
|
-
"owner",
|
|
38
|
-
"pack",
|
|
39
|
-
"policies",
|
|
40
|
-
"prune",
|
|
41
|
-
"remove",
|
|
42
|
-
"self-update",
|
|
43
|
-
"tag",
|
|
44
|
-
"team",
|
|
45
|
-
"upgrade",
|
|
46
|
-
"upgrade-interactive",
|
|
47
|
-
"version",
|
|
48
|
-
"versions",
|
|
49
|
-
"why",
|
|
50
|
-
"workspace",
|
|
51
|
-
"workspaces"
|
|
52
|
-
];
|
|
53
|
-
var executorCommands = {
|
|
54
|
-
npm: "npx",
|
|
55
|
-
yarn: "yarn dlx",
|
|
56
|
-
pnpm: "pnpm dlx",
|
|
57
|
-
bun: "bun x"
|
|
58
|
-
};
|
|
59
|
-
function parse(command) {
|
|
60
|
-
var args = [];
|
|
61
|
-
var lastQuote = false;
|
|
62
|
-
var escaped = false;
|
|
63
|
-
var part = "";
|
|
64
|
-
for (var i = 0; i < command.length; ++i) {
|
|
65
|
-
var char = command.charAt(i);
|
|
66
|
-
if (char === "\\") {
|
|
67
|
-
part += char;
|
|
68
|
-
escaped = true;
|
|
69
|
-
} else {
|
|
70
|
-
if (char === " " && !lastQuote) {
|
|
71
|
-
args.push(part);
|
|
72
|
-
part = "";
|
|
73
|
-
} else if (!escaped && (char === "\"" || char === "'")) {
|
|
74
|
-
part += char;
|
|
75
|
-
if (char === lastQuote) lastQuote = false;
|
|
76
|
-
else if (!lastQuote) lastQuote = char;
|
|
77
|
-
} else part += char;
|
|
78
|
-
escaped = false;
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
args.push(part);
|
|
82
|
-
return args;
|
|
83
|
-
}
|
|
84
|
-
function convertAddRemoveArgs(args) {
|
|
85
|
-
return args.map(function(item) {
|
|
86
|
-
switch (item) {
|
|
87
|
-
case "--no-lockfile": return "--no-package-lock";
|
|
88
|
-
case "--production": return "--save-prod";
|
|
89
|
-
case "--dev": return "--save-dev";
|
|
90
|
-
case "--optional": return "--save-optional";
|
|
91
|
-
case "--exact": return "--save-exact";
|
|
92
|
-
default: return item;
|
|
93
|
-
}
|
|
94
|
-
});
|
|
95
|
-
}
|
|
96
|
-
var yarnToNpmTable = {
|
|
97
|
-
add: function(args) {
|
|
98
|
-
if (args.length === 2 && args[1] === "--force") return ["rebuild"];
|
|
99
|
-
args[0] = "install";
|
|
100
|
-
return convertAddRemoveArgs(args);
|
|
101
|
-
},
|
|
102
|
-
remove: function(args) {
|
|
103
|
-
args[0] = "uninstall";
|
|
104
|
-
return convertAddRemoveArgs(args);
|
|
105
|
-
},
|
|
106
|
-
version: function(args) {
|
|
107
|
-
return args.map(function(item) {
|
|
108
|
-
switch (item) {
|
|
109
|
-
case "--major": return "major";
|
|
110
|
-
case "--minor": return "minor";
|
|
111
|
-
case "--patch": return "patch";
|
|
112
|
-
default: return item;
|
|
113
|
-
}
|
|
114
|
-
});
|
|
115
|
-
},
|
|
116
|
-
install: "install",
|
|
117
|
-
list: function(args) {
|
|
118
|
-
args[0] = "ls";
|
|
119
|
-
var patternIndex = args.findIndex(function(item) {
|
|
120
|
-
return item === "--pattern";
|
|
121
|
-
});
|
|
122
|
-
if (patternIndex >= 0 && args[patternIndex + 1]) {
|
|
123
|
-
var packages = args[patternIndex + 1].replace(/["']([^"']+)["']/, "$1").split("|");
|
|
124
|
-
args.splice(patternIndex, 2, packages.join(" "));
|
|
125
|
-
}
|
|
126
|
-
return args;
|
|
127
|
-
},
|
|
128
|
-
init: "init",
|
|
129
|
-
create: "init",
|
|
130
|
-
outdated: "outdated",
|
|
131
|
-
run: "run",
|
|
132
|
-
global: function(args) {
|
|
133
|
-
switch (args[1]) {
|
|
134
|
-
case "add":
|
|
135
|
-
args.shift();
|
|
136
|
-
args = yarnToNpmTable.add(args);
|
|
137
|
-
args.push("--global");
|
|
138
|
-
return args;
|
|
139
|
-
case "remove":
|
|
140
|
-
args.shift();
|
|
141
|
-
args = yarnToNpmTable.remove(args);
|
|
142
|
-
args.push("--global");
|
|
143
|
-
return args;
|
|
144
|
-
case "list":
|
|
145
|
-
args.shift();
|
|
146
|
-
args = yarnToNpmTable.list(args);
|
|
147
|
-
args.push("--global");
|
|
148
|
-
return args;
|
|
149
|
-
default:
|
|
150
|
-
args.push("\n# couldn't auto-convert command");
|
|
151
|
-
return args;
|
|
152
|
-
}
|
|
153
|
-
},
|
|
154
|
-
pack: function(args) {
|
|
155
|
-
return args.map(function(item) {
|
|
156
|
-
if (item === "--filename") return "--pack-destination";
|
|
157
|
-
return item;
|
|
158
|
-
});
|
|
159
|
-
}
|
|
160
|
-
};
|
|
161
|
-
function yarnToNPM(_m, command) {
|
|
162
|
-
command = (command || "").trim();
|
|
163
|
-
if (command === "") return "npm install";
|
|
164
|
-
var args = parse(command);
|
|
165
|
-
var firstCommand = (/\w+/.exec(command) || [""])[0];
|
|
166
|
-
if (unchangedCLICommands.includes(args[0])) return "npm " + command;
|
|
167
|
-
else if (args[0] in yarnToNpmTable) {
|
|
168
|
-
var converter = yarnToNpmTable[args[0]];
|
|
169
|
-
if (typeof converter === "function") args = converter(args);
|
|
170
|
-
else args[0] = converter;
|
|
171
|
-
return "npm " + args.filter(Boolean).join(" ");
|
|
172
|
-
} else if (!yarnCLICommands.includes(firstCommand)) return "npm run " + command;
|
|
173
|
-
else return "npm " + command + "\n# couldn't auto-convert command";
|
|
174
|
-
}
|
|
175
|
-
function convertInstallArgs$1(args) {
|
|
176
|
-
if (args.includes("--global") || args.includes("-g")) args.unshift("global");
|
|
177
|
-
return args.map(function(item) {
|
|
178
|
-
switch (item) {
|
|
179
|
-
case "--save-dev":
|
|
180
|
-
case "-D": return "--dev";
|
|
181
|
-
case "--save-prod":
|
|
182
|
-
case "-P": return "--production";
|
|
183
|
-
case "--no-package-lock": return "--no-lockfile";
|
|
184
|
-
case "--save-optional":
|
|
185
|
-
case "-O": return "--optional";
|
|
186
|
-
case "--save-exact":
|
|
187
|
-
case "-E": return "--exact";
|
|
188
|
-
case "--save":
|
|
189
|
-
case "-S":
|
|
190
|
-
case "--global":
|
|
191
|
-
case "-g": return "";
|
|
192
|
-
default: return item;
|
|
193
|
-
}
|
|
194
|
-
});
|
|
195
|
-
}
|
|
196
|
-
var npmToYarnTable = {
|
|
197
|
-
install: function(args) {
|
|
198
|
-
if (args.length === 1) return ["install"];
|
|
199
|
-
args[0] = "add";
|
|
200
|
-
return convertInstallArgs$1(args);
|
|
201
|
-
},
|
|
202
|
-
i: function(args) {
|
|
203
|
-
return npmToYarnTable.install(args);
|
|
204
|
-
},
|
|
205
|
-
uninstall: function(args) {
|
|
206
|
-
args[0] = "remove";
|
|
207
|
-
return convertInstallArgs$1(args);
|
|
208
|
-
},
|
|
209
|
-
un: function(args) {
|
|
210
|
-
return npmToYarnTable.uninstall(args);
|
|
211
|
-
},
|
|
212
|
-
remove: function(args) {
|
|
213
|
-
return npmToYarnTable.uninstall(args);
|
|
214
|
-
},
|
|
215
|
-
r: function(args) {
|
|
216
|
-
return npmToYarnTable.uninstall(args);
|
|
217
|
-
},
|
|
218
|
-
rm: function(args) {
|
|
219
|
-
return npmToYarnTable.uninstall(args);
|
|
220
|
-
},
|
|
221
|
-
version: function(args) {
|
|
222
|
-
return args.map(function(item) {
|
|
223
|
-
switch (item) {
|
|
224
|
-
case "major": return "--major";
|
|
225
|
-
case "minor": return "--minor";
|
|
226
|
-
case "patch": return "--patch";
|
|
227
|
-
default: return item;
|
|
228
|
-
}
|
|
229
|
-
});
|
|
230
|
-
},
|
|
231
|
-
rb: function(args) {
|
|
232
|
-
return npmToYarnTable.rebuild(args);
|
|
233
|
-
},
|
|
234
|
-
rebuild: function(args) {
|
|
235
|
-
args[0] = "add";
|
|
236
|
-
args.push("--force");
|
|
237
|
-
return args;
|
|
238
|
-
},
|
|
239
|
-
run: function(args) {
|
|
240
|
-
if (args[1] && !unchangedCLICommands.includes(args[1]) && !yarnCLICommands.includes(args[1])) args.splice(0, 1);
|
|
241
|
-
return args;
|
|
242
|
-
},
|
|
243
|
-
exec: function(args) {
|
|
244
|
-
args[0] = "run";
|
|
245
|
-
return npmToYarnTable.run(args);
|
|
246
|
-
},
|
|
247
|
-
ls: function(args) {
|
|
248
|
-
args[0] = "list";
|
|
249
|
-
var ended = false;
|
|
250
|
-
var packages = args.filter(function(item, id) {
|
|
251
|
-
if (id > 0 && !ended) {
|
|
252
|
-
ended = item.startsWith("-");
|
|
253
|
-
return !ended;
|
|
254
|
-
}
|
|
255
|
-
return false;
|
|
256
|
-
});
|
|
257
|
-
if (packages.length > 0) args.splice(1, packages.length, "--pattern", "\"" + packages.join("|") + "\"");
|
|
258
|
-
return args;
|
|
259
|
-
},
|
|
260
|
-
list: function(args) {
|
|
261
|
-
return npmToYarnTable.ls(args);
|
|
262
|
-
},
|
|
263
|
-
init: function(args) {
|
|
264
|
-
if (args[1] && !args[1].startsWith("-")) {
|
|
265
|
-
args[0] = "create";
|
|
266
|
-
var m = args[1].match(/(.+)@latest/);
|
|
267
|
-
if (m) args[1] = m[1];
|
|
268
|
-
}
|
|
269
|
-
return args.filter(function(item) {
|
|
270
|
-
return item !== "--scope";
|
|
271
|
-
});
|
|
272
|
-
},
|
|
273
|
-
create: function(args) {
|
|
274
|
-
return npmToYarnTable.init(args);
|
|
275
|
-
},
|
|
276
|
-
ln: "link",
|
|
277
|
-
t: "test",
|
|
278
|
-
tst: "test",
|
|
279
|
-
outdated: "outdated",
|
|
280
|
-
pack: function(args) {
|
|
281
|
-
return args.map(function(item) {
|
|
282
|
-
if (item.startsWith("--pack-destination")) return item.replace(/^--pack-destination[\s=]/, "--filename ");
|
|
283
|
-
return item;
|
|
284
|
-
});
|
|
285
|
-
}
|
|
286
|
-
};
|
|
287
|
-
function npmToYarn(_m, command) {
|
|
288
|
-
var args = parse((command || "").trim());
|
|
289
|
-
var index = args.findIndex(function(a) {
|
|
290
|
-
return a === "--";
|
|
291
|
-
});
|
|
292
|
-
if (index >= 0) args.splice(index, 1);
|
|
293
|
-
if (unchangedCLICommands.includes(args[0])) return "yarn " + args.filter(Boolean).join(" ");
|
|
294
|
-
else if (args[0] in npmToYarnTable) {
|
|
295
|
-
var converter = npmToYarnTable[args[0]];
|
|
296
|
-
if (typeof converter === "function") args = converter(args);
|
|
297
|
-
else args[0] = converter;
|
|
298
|
-
return "yarn " + args.filter(Boolean).join(" ");
|
|
299
|
-
} else return "npm " + command + "\n# couldn't auto-convert command";
|
|
300
|
-
}
|
|
301
|
-
function convertPnpmInstallArgs(args) {
|
|
302
|
-
return args.map(function(item) {
|
|
303
|
-
switch (item) {
|
|
304
|
-
case "--save":
|
|
305
|
-
case "-S": return "";
|
|
306
|
-
case "--no-package-lock": return "--frozen-lockfile";
|
|
307
|
-
default: return item;
|
|
308
|
-
}
|
|
309
|
-
});
|
|
310
|
-
}
|
|
311
|
-
function convertFilterArg(args) {
|
|
312
|
-
if (args.length > 1) {
|
|
313
|
-
var filter = args.filter(function(item, index) {
|
|
314
|
-
return index !== 0 && !item.startsWith("-");
|
|
315
|
-
});
|
|
316
|
-
if (filter.length > 0) {
|
|
317
|
-
args = args.filter(function(item, index) {
|
|
318
|
-
return index === 0 || item.startsWith("-");
|
|
319
|
-
});
|
|
320
|
-
args.push("--filter");
|
|
321
|
-
args.push(filter.join(" "));
|
|
322
|
-
}
|
|
323
|
-
}
|
|
324
|
-
return args;
|
|
325
|
-
}
|
|
326
|
-
var npmToPnpmTable = {
|
|
327
|
-
install: function(args) {
|
|
328
|
-
if (args.length > 1 && args.filter(function(item) {
|
|
329
|
-
return !item.startsWith("-");
|
|
330
|
-
}).length > 1) args[0] = "add";
|
|
331
|
-
return convertPnpmInstallArgs(args);
|
|
332
|
-
},
|
|
333
|
-
i: function(args) {
|
|
334
|
-
return npmToPnpmTable.install(args);
|
|
335
|
-
},
|
|
336
|
-
uninstall: function(args) {
|
|
337
|
-
args[0] = "remove";
|
|
338
|
-
return convertPnpmInstallArgs(args);
|
|
339
|
-
},
|
|
340
|
-
un: function(args) {
|
|
341
|
-
return npmToPnpmTable.uninstall(args);
|
|
342
|
-
},
|
|
343
|
-
remove: function(args) {
|
|
344
|
-
return npmToPnpmTable.uninstall(args);
|
|
345
|
-
},
|
|
346
|
-
r: function(args) {
|
|
347
|
-
return npmToPnpmTable.uninstall(args);
|
|
348
|
-
},
|
|
349
|
-
rm: function(args) {
|
|
350
|
-
return npmToPnpmTable.uninstall(args);
|
|
351
|
-
},
|
|
352
|
-
rb: function(args) {
|
|
353
|
-
return npmToPnpmTable.rebuild(args);
|
|
354
|
-
},
|
|
355
|
-
rebuild: function(args) {
|
|
356
|
-
args[0] = "rebuild";
|
|
357
|
-
return convertFilterArg(args);
|
|
358
|
-
},
|
|
359
|
-
run: "run",
|
|
360
|
-
exec: "exec",
|
|
361
|
-
ls: function(args) {
|
|
362
|
-
return npmToPnpmTable.list(args);
|
|
363
|
-
},
|
|
364
|
-
list: function(args) {
|
|
365
|
-
return args.map(function(item) {
|
|
366
|
-
if (item.startsWith("--depth=")) return "--depth ".concat(item.split("=")[1]);
|
|
367
|
-
switch (item) {
|
|
368
|
-
case "--production": return "--prod";
|
|
369
|
-
case "--development": return "--dev";
|
|
370
|
-
default: return item;
|
|
371
|
-
}
|
|
372
|
-
});
|
|
373
|
-
},
|
|
374
|
-
init: function(args) {
|
|
375
|
-
if (args[1] && !args[1].startsWith("-")) {
|
|
376
|
-
args[0] = "create";
|
|
377
|
-
var m = args[1].match(/(.+)@latest/);
|
|
378
|
-
if (m) args[1] = m[1];
|
|
379
|
-
}
|
|
380
|
-
return args.filter(function(item) {
|
|
381
|
-
return item !== "--scope";
|
|
382
|
-
});
|
|
383
|
-
},
|
|
384
|
-
create: function(args) {
|
|
385
|
-
return npmToPnpmTable.init(args);
|
|
386
|
-
},
|
|
387
|
-
ln: "link",
|
|
388
|
-
t: "test",
|
|
389
|
-
test: "test",
|
|
390
|
-
tst: "test",
|
|
391
|
-
start: "start",
|
|
392
|
-
link: "link",
|
|
393
|
-
unlink: function(args) {
|
|
394
|
-
return convertFilterArg(args);
|
|
395
|
-
},
|
|
396
|
-
outdated: "outdated",
|
|
397
|
-
pack: function(args) {
|
|
398
|
-
return args.map(function(item) {
|
|
399
|
-
if (item.startsWith("--pack-destination")) return item.replace(/^--pack-destination[\s=]/, "--pack-destination ");
|
|
400
|
-
return item;
|
|
401
|
-
});
|
|
402
|
-
}
|
|
403
|
-
};
|
|
404
|
-
function npmToPnpm(_m, command) {
|
|
405
|
-
var args = parse((command || "").trim());
|
|
406
|
-
var index = args.findIndex(function(a) {
|
|
407
|
-
return a === "--";
|
|
408
|
-
});
|
|
409
|
-
if (index >= 0) args.splice(index, 1);
|
|
410
|
-
if (args[0] in npmToPnpmTable) {
|
|
411
|
-
var converter = npmToPnpmTable[args[0]];
|
|
412
|
-
if (typeof converter === "function") args = converter(args);
|
|
413
|
-
else args[0] = converter;
|
|
414
|
-
return "pnpm " + args.filter(Boolean).join(" ");
|
|
415
|
-
} else return "npm " + command + "\n# couldn't auto-convert command";
|
|
416
|
-
}
|
|
417
|
-
function convertInstallArgs(args) {
|
|
418
|
-
return args.map(function(item) {
|
|
419
|
-
switch (item) {
|
|
420
|
-
case "--save-dev":
|
|
421
|
-
case "--development":
|
|
422
|
-
case "-D": return "--dev";
|
|
423
|
-
case "--save-prod":
|
|
424
|
-
case "-P": return "--production";
|
|
425
|
-
case "--no-package-lock": return "--no-save";
|
|
426
|
-
case "--save-optional":
|
|
427
|
-
case "-O": return "--optional";
|
|
428
|
-
case "--save-exact":
|
|
429
|
-
case "-E": return "--exact";
|
|
430
|
-
case "--save":
|
|
431
|
-
case "-S": return "";
|
|
432
|
-
case "--global":
|
|
433
|
-
case "-g": return "--global";
|
|
434
|
-
default: return item;
|
|
435
|
-
}
|
|
436
|
-
});
|
|
437
|
-
}
|
|
438
|
-
function npmToBun(_m, command) {
|
|
439
|
-
var args = parse((command || "").trim());
|
|
440
|
-
var index = args.findIndex(function(a) {
|
|
441
|
-
return a === "--";
|
|
442
|
-
});
|
|
443
|
-
if (index >= 0) args.splice(index, 1);
|
|
444
|
-
var cmd = "bun";
|
|
445
|
-
switch (args[0]) {
|
|
446
|
-
case "install":
|
|
447
|
-
case "i":
|
|
448
|
-
if (args.length === 1) args = ["install"];
|
|
449
|
-
else args[0] = "add";
|
|
450
|
-
args = convertInstallArgs(args);
|
|
451
|
-
break;
|
|
452
|
-
case "uninstall":
|
|
453
|
-
case "un":
|
|
454
|
-
case "remove":
|
|
455
|
-
case "r":
|
|
456
|
-
case "rm":
|
|
457
|
-
args[0] = "remove";
|
|
458
|
-
args = convertInstallArgs(args);
|
|
459
|
-
break;
|
|
460
|
-
case "cache":
|
|
461
|
-
if (args[1] === "clean") args = [
|
|
462
|
-
"pm",
|
|
463
|
-
"cache",
|
|
464
|
-
"rm"
|
|
465
|
-
].concat(args.slice(2));
|
|
466
|
-
else cmd = "npm";
|
|
467
|
-
break;
|
|
468
|
-
case "rebuild":
|
|
469
|
-
case "rb":
|
|
470
|
-
args[0] = "add";
|
|
471
|
-
args.push("--force");
|
|
472
|
-
break;
|
|
473
|
-
case "run": break;
|
|
474
|
-
case "list":
|
|
475
|
-
case "ls":
|
|
476
|
-
args = convertInstallArgs(args);
|
|
477
|
-
args[0] = "ls";
|
|
478
|
-
args.unshift("pm");
|
|
479
|
-
break;
|
|
480
|
-
case "init":
|
|
481
|
-
case "create":
|
|
482
|
-
if (args[1]) if (args[1].startsWith("@")) {
|
|
483
|
-
cmd = "bunx";
|
|
484
|
-
args[1] = args[1].replace("/", "/create-");
|
|
485
|
-
args = args.slice(1);
|
|
486
|
-
} else if (!args[1].startsWith("-")) {
|
|
487
|
-
cmd = "bunx";
|
|
488
|
-
args[1] = "create-".concat(args[1].replace("@latest", ""));
|
|
489
|
-
args = args.slice(1);
|
|
490
|
-
} else args[0] = "init";
|
|
491
|
-
break;
|
|
492
|
-
case "link":
|
|
493
|
-
case "ln":
|
|
494
|
-
args = convertInstallArgs(args);
|
|
495
|
-
args[0] = "link";
|
|
496
|
-
break;
|
|
497
|
-
case "stop":
|
|
498
|
-
case "start":
|
|
499
|
-
case "unlink": break;
|
|
500
|
-
case "test":
|
|
501
|
-
case "t":
|
|
502
|
-
case "tst":
|
|
503
|
-
args[0] = "test";
|
|
504
|
-
args.unshift("run");
|
|
505
|
-
break;
|
|
506
|
-
case "exec":
|
|
507
|
-
cmd = "bunx";
|
|
508
|
-
args.splice(0, 1);
|
|
509
|
-
break;
|
|
510
|
-
default:
|
|
511
|
-
cmd = "npm";
|
|
512
|
-
break;
|
|
513
|
-
}
|
|
514
|
-
var filtered = args.filter(Boolean).filter(function(arg) {
|
|
515
|
-
return arg !== "--";
|
|
516
|
-
});
|
|
517
|
-
return "".concat(cmd, " ").concat(filtered.join(" ")).concat(cmd === "npm" ? "\n# couldn't auto-convert command" : "").replace("=", " ");
|
|
518
|
-
}
|
|
519
|
-
/**
|
|
520
|
-
* Converts between npm and yarn command
|
|
521
|
-
*/
|
|
522
|
-
function convert(str, to) {
|
|
523
|
-
if (str.includes("npx") || str.includes("yarn dlx") || str.includes("pnpm dlx") || str.includes("bun x")) {
|
|
524
|
-
var executor = str.includes("npx") ? "npx" : str.includes("yarn dlx") ? "yarn dlx" : str.includes("pnpm dlx") ? "pnpm dlx" : "bun x";
|
|
525
|
-
return str.replace(executor, executorCommands[to]);
|
|
526
|
-
} else if (to === "npm") return str.replace(/yarn(?: +([^&\n\r]*))?/gm, yarnToNPM);
|
|
527
|
-
else if (to === "pnpm") return str.replace(/npm(?: +([^&\n\r]*))?/gm, npmToPnpm);
|
|
528
|
-
else if (to === "bun") return str.replace(/npm(?: +([^&\n\r]*))?/gm, npmToBun);
|
|
529
|
-
else return str.replace(/npm(?: +([^&\n\r]*))?/gm, npmToYarn);
|
|
530
|
-
}
|
|
531
|
-
//#endregion
|
|
532
|
-
//#region src/mdx-plugins/remark-npm.ts
|
|
533
|
-
function convertLines(cmd, to) {
|
|
534
|
-
return cmd.split("\n").map((l) => convert(l, to)).join("\n");
|
|
535
|
-
}
|
|
536
|
-
/**
|
|
537
|
-
* It generates multiple tabs of codeblocks for different package managers from a npm command codeblock.
|
|
538
|
-
*/
|
|
539
|
-
function remarkNpm({ persist = false, packageManagers = [
|
|
540
|
-
{
|
|
541
|
-
command: (cmd) => cmd,
|
|
542
|
-
name: "npm"
|
|
543
|
-
},
|
|
544
|
-
{
|
|
545
|
-
command: (cmd) => convertLines(cmd, "pnpm"),
|
|
546
|
-
name: "pnpm"
|
|
547
|
-
},
|
|
548
|
-
{
|
|
549
|
-
command: (cmd) => convertLines(cmd, "yarn"),
|
|
550
|
-
name: "yarn"
|
|
551
|
-
},
|
|
552
|
-
{
|
|
553
|
-
command: (cmd) => convertLines(cmd, "bun"),
|
|
554
|
-
name: "bun"
|
|
555
|
-
}
|
|
556
|
-
] } = {}) {
|
|
557
|
-
return (tree) => {
|
|
558
|
-
visit(tree, "code", (node, idx, parent) => {
|
|
559
|
-
if (typeof idx !== "number" || !parent) return;
|
|
560
|
-
let code;
|
|
561
|
-
switch (node.lang) {
|
|
562
|
-
case "package-install":
|
|
563
|
-
code = node.value;
|
|
564
|
-
if (!code.startsWith("npm") && !code.startsWith("npx")) code = `npm install ${code}`;
|
|
565
|
-
break;
|
|
566
|
-
case "npm":
|
|
567
|
-
code = node.value;
|
|
568
|
-
break;
|
|
569
|
-
default: return;
|
|
570
|
-
}
|
|
571
|
-
const options = {
|
|
572
|
-
persist,
|
|
573
|
-
tabs: [],
|
|
574
|
-
triggers: []
|
|
575
|
-
};
|
|
576
|
-
for (const manager of packageManagers) {
|
|
577
|
-
const value = manager.value ?? manager.name;
|
|
578
|
-
const command = manager.command(code);
|
|
579
|
-
if (!command || command.length === 0) continue;
|
|
580
|
-
options.defaultValue ??= value;
|
|
581
|
-
options.triggers.push({
|
|
582
|
-
value,
|
|
583
|
-
children: [{
|
|
584
|
-
type: "text",
|
|
585
|
-
value: manager.name
|
|
586
|
-
}]
|
|
587
|
-
});
|
|
588
|
-
options.tabs.push({
|
|
589
|
-
value,
|
|
590
|
-
children: [{
|
|
591
|
-
type: "code",
|
|
592
|
-
lang: "bash",
|
|
593
|
-
meta: node.meta,
|
|
594
|
-
value: command
|
|
595
|
-
}]
|
|
596
|
-
});
|
|
597
|
-
}
|
|
598
|
-
parent.children[idx] = generateCodeBlockTabs(options);
|
|
599
|
-
return "skip";
|
|
600
|
-
});
|
|
601
|
-
};
|
|
602
|
-
}
|
|
603
|
-
//#endregion
|
|
604
|
-
export { remarkNpm as t };
|
package/dist/url-CWbf4MFh.js
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
//#region src/utils/url.tsx
|
|
2
|
-
/**
|
|
3
|
-
* The base path (Vite), always ends with `/`.
|
|
4
|
-
*/
|
|
5
|
-
let BASE_PATH = typeof import.meta.env !== "undefined" && typeof import.meta.env.BASE_URL === "string" ? import.meta.env.BASE_URL : "/";
|
|
6
|
-
if (!BASE_PATH.endsWith("/")) BASE_PATH += "/";
|
|
7
|
-
/**
|
|
8
|
-
* normalize URL into the Fumadocs standard form (`/slug-1/slug-2`).
|
|
9
|
-
*
|
|
10
|
-
* This includes URLs with trailing slashes.
|
|
11
|
-
*/
|
|
12
|
-
function normalizeUrl(url) {
|
|
13
|
-
if (url.startsWith("http://") || url.startsWith("https://")) return url;
|
|
14
|
-
if (!url.startsWith("/")) url = "/" + url;
|
|
15
|
-
if (url.length > 1 && url.endsWith("/")) url = url.slice(0, -1);
|
|
16
|
-
return url;
|
|
17
|
-
}
|
|
18
|
-
//#endregion
|
|
19
|
-
export { normalizeUrl as n, BASE_PATH as t };
|