@farming-labs/next 0.2.119 → 0.2.121
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/README.md +30 -1
- package/dist/api-reference-CTAOPJih.d.mts +49 -0
- package/dist/api-reference-banner-q98BnSRL.mjs +94 -0
- package/dist/api-reference.d.mts +3 -46
- package/dist/api-reference.mjs +10 -90
- package/dist/config-2dZm_AHg.mjs +2345 -0
- package/dist/config-yzp9kyZ0.d.mts +21 -0
- package/dist/config.d.mts +2 -7
- package/dist/config.mjs +1 -2254
- package/dist/core-DRyvBL8l.mjs +16 -0
- package/dist/fumadocs-api-page.d.mts +4 -1
- package/dist/fumadocs-api-page.mjs +16 -2
- package/dist/fumadocs-renderer.d.mts +13 -0
- package/dist/fumadocs-renderer.mjs +13 -0
- package/dist/index.d.mts +3 -3
- package/dist/index.mjs +3 -2
- package/dist/layout.mjs +1 -1
- package/dist/mdx-plugins/remark-code-group.d.mts +7 -2
- package/dist/mdx-plugins/remark-code-group.mjs +2 -2
- package/dist/mdx-plugins/remark-heading.mjs +1 -1
- package/dist/mdx-plugins/remark-markdown-alternate.mjs +1 -1
- package/package.json +9 -4
- package/dist/code-block-themes-CCE5ViGj.mjs +0 -25
package/README.md
CHANGED
|
@@ -61,6 +61,35 @@ Import the selected theme in your global stylesheet:
|
|
|
61
61
|
Write documentation pages under `app/docs/` or `src/app/docs/`. The CLI also adds the root
|
|
62
62
|
`RootProvider`, generated docs layout, and server routes needed for a complete setup.
|
|
63
63
|
|
|
64
|
+
## Extending MDX compilation
|
|
65
|
+
|
|
66
|
+
Pass adapter options as the third `withDocs` argument. Plugin module names (or absolute paths)
|
|
67
|
+
and JSON options work with both Webpack and Turbopack:
|
|
68
|
+
|
|
69
|
+
```ts
|
|
70
|
+
import { withDocs } from "@farming-labs/next/config";
|
|
71
|
+
import docsConfig from "./docs.config";
|
|
72
|
+
|
|
73
|
+
export default withDocs({}, docsConfig, {
|
|
74
|
+
mdx: {
|
|
75
|
+
remarkPlugins: ["remark-directive"],
|
|
76
|
+
rehypePlugins: [["rehype-external-links", { target: "_blank" }]],
|
|
77
|
+
},
|
|
78
|
+
});
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
Install the plugins in your application. Extra plugins run after the built-in plugins in their
|
|
82
|
+
respective phase; frontmatter, heading IDs, TOC, Markdown alternate links, and syntax highlighting
|
|
83
|
+
remain enabled. Put callbacks and other non-JSON configuration inside a local plugin module and
|
|
84
|
+
pass its absolute path, for example `import.meta.resolve("./plugins/highlight.mjs")` converted
|
|
85
|
+
with `fileURLToPath` from `node:url`.
|
|
86
|
+
|
|
87
|
+
For a migration with its own highlighter, set `mdx.codeHighlighter` to that plugin's module name
|
|
88
|
+
or `[module, options]` tuple. This replaces only the default code-highlighting step, so code is
|
|
89
|
+
highlighted once. The custom plugin owns its theme and code-block behavior. Omitting `mdx` keeps
|
|
90
|
+
the existing defaults. Use `undefined` as the second argument if you are not passing a live docs
|
|
91
|
+
config. These hooks do not configure Fumadocs collections or replace its source loader.
|
|
92
|
+
|
|
64
93
|
## Main entrypoints
|
|
65
94
|
|
|
66
95
|
| Entrypoint | Purpose |
|
|
@@ -75,7 +104,7 @@ Write documentation pages under `app/docs/` or `src/app/docs/`. The CLI also add
|
|
|
75
104
|
|
|
76
105
|
- Next.js 16 or newer
|
|
77
106
|
- React and React DOM 19.2 or newer
|
|
78
|
-
- `@farming-labs/docs` and `@farming-labs/theme`
|
|
107
|
+
- `@farming-labs/docs` 0.2.121 or newer and `@farming-labs/theme`
|
|
79
108
|
|
|
80
109
|
## Learn more
|
|
81
110
|
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { DocsConfig } from "@farming-labs/docs";
|
|
2
|
+
import { resolveApiReferenceConfig as resolveApiReferenceConfig$1 } from "@farming-labs/docs/runtime";
|
|
3
|
+
import { ReactNode } from "react";
|
|
4
|
+
import * as react_jsx_runtime0 from "react/jsx-runtime";
|
|
5
|
+
|
|
6
|
+
//#region src/api-reference-banner.d.ts
|
|
7
|
+
declare function withNextApiReferenceBanner(config: DocsConfig): DocsConfig;
|
|
8
|
+
//#endregion
|
|
9
|
+
//#region src/api-reference.d.ts
|
|
10
|
+
interface NextApiReferenceSourceState {
|
|
11
|
+
apiReference: ReturnType<typeof resolveApiReferenceConfig$1>;
|
|
12
|
+
document: Record<string, unknown>;
|
|
13
|
+
info: {
|
|
14
|
+
title: string;
|
|
15
|
+
description?: string;
|
|
16
|
+
};
|
|
17
|
+
primaryServerUrl?: string;
|
|
18
|
+
pages: Array<{
|
|
19
|
+
url: string;
|
|
20
|
+
} & Record<string, any>>;
|
|
21
|
+
server: any;
|
|
22
|
+
source: {
|
|
23
|
+
getPage: (slug?: string[]) => any;
|
|
24
|
+
getPages: () => Array<any>;
|
|
25
|
+
getPageTree: () => any;
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
declare function buildNextOpenApiDocument(config: DocsConfig): Record<string, unknown>;
|
|
29
|
+
declare function flattenApiReferencePageTreeForSidebar(tree: any): any;
|
|
30
|
+
declare function createNextApiReference(config: DocsConfig): (request?: Request) => Promise<Response>;
|
|
31
|
+
declare function createNextApiReferencePage(config: DocsConfig): (props?: {
|
|
32
|
+
params?: Promise<{
|
|
33
|
+
slug?: string[];
|
|
34
|
+
}> | {
|
|
35
|
+
slug?: string[];
|
|
36
|
+
};
|
|
37
|
+
}) => Promise<react_jsx_runtime0.JSX.Element>;
|
|
38
|
+
declare function createNextApiReferenceLayout(config: DocsConfig): (props: {
|
|
39
|
+
children: React.ReactNode;
|
|
40
|
+
params?: Promise<{
|
|
41
|
+
slug?: string[];
|
|
42
|
+
}> | {
|
|
43
|
+
slug?: string[];
|
|
44
|
+
};
|
|
45
|
+
}) => Promise<react_jsx_runtime0.JSX.Element>;
|
|
46
|
+
declare function getNextApiReferenceSourceState(config: DocsConfig, versionId?: string): Promise<NextApiReferenceSourceState>;
|
|
47
|
+
declare function getNextApiReferenceMode(config: DocsConfig): "farming-labs" | "fumadocs" | "scalar";
|
|
48
|
+
//#endregion
|
|
49
|
+
export { createNextApiReferencePage as a, getNextApiReferenceSourceState as c, createNextApiReferenceLayout as i, resolveApiReferenceConfig$1 as l, buildNextOpenApiDocument as n, flattenApiReferencePageTreeForSidebar as o, createNextApiReference as r, getNextApiReferenceMode as s, NextApiReferenceSourceState as t, withNextApiReferenceBanner as u };
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { resolveApiReferenceConfig } from "@farming-labs/docs/runtime";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { SidebarTabsDropdown } from "fumadocs-ui/components/sidebar/tabs/dropdown";
|
|
4
|
+
|
|
5
|
+
//#region src/api-reference-banner.tsx
|
|
6
|
+
function getDocsUrl(config) {
|
|
7
|
+
if (typeof config.nav?.url === "string") return config.nav.url;
|
|
8
|
+
return `/${config.entry ?? "docs"}`;
|
|
9
|
+
}
|
|
10
|
+
function SwitcherGlyph({ kind }) {
|
|
11
|
+
const isApi = kind === "api";
|
|
12
|
+
return /* @__PURE__ */ jsx("span", {
|
|
13
|
+
className: "fd-api-reference-switcher-glyph",
|
|
14
|
+
"data-kind": kind,
|
|
15
|
+
"aria-hidden": "true",
|
|
16
|
+
children: isApi ? /* @__PURE__ */ jsx("svg", {
|
|
17
|
+
viewBox: "0 0 24 24",
|
|
18
|
+
fill: "none",
|
|
19
|
+
children: /* @__PURE__ */ jsx("path", {
|
|
20
|
+
d: "M8 8L4 12L8 16M16 8L20 12L16 16M13.5 6L10.5 18",
|
|
21
|
+
stroke: "currentColor",
|
|
22
|
+
strokeWidth: "1.8",
|
|
23
|
+
strokeLinecap: "round",
|
|
24
|
+
strokeLinejoin: "round"
|
|
25
|
+
})
|
|
26
|
+
}) : /* @__PURE__ */ jsx("svg", {
|
|
27
|
+
viewBox: "0 0 24 24",
|
|
28
|
+
fill: "none",
|
|
29
|
+
children: /* @__PURE__ */ jsx("path", {
|
|
30
|
+
d: "M4.75 6.75C4.75 5.64543 5.64543 4.75 6.75 4.75H11.25V19.25H6.75C5.64543 19.25 4.75 18.3546 4.75 17.25V6.75ZM12.75 4.75H17.25C18.3546 4.75 19.25 5.64543 19.25 6.75V17.25C19.25 18.3546 18.3546 19.25 17.25 19.25H12.75V4.75Z",
|
|
31
|
+
stroke: "currentColor",
|
|
32
|
+
strokeWidth: "1.8",
|
|
33
|
+
strokeLinejoin: "round"
|
|
34
|
+
})
|
|
35
|
+
})
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
function ApiReferenceSwitcher({ docsUrl, apiUrl }) {
|
|
39
|
+
return /* @__PURE__ */ jsx(SidebarTabsDropdown, {
|
|
40
|
+
className: "fd-api-reference-switcher w-full mb-4",
|
|
41
|
+
options: [{
|
|
42
|
+
url: docsUrl,
|
|
43
|
+
title: "Documentation",
|
|
44
|
+
description: "Guides & concepts",
|
|
45
|
+
icon: /* @__PURE__ */ jsx(SwitcherGlyph, { kind: "docs" })
|
|
46
|
+
}, {
|
|
47
|
+
url: apiUrl,
|
|
48
|
+
title: "API Reference",
|
|
49
|
+
description: "Endpoints & examples",
|
|
50
|
+
icon: /* @__PURE__ */ jsx(SwitcherGlyph, { kind: "api" })
|
|
51
|
+
}]
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
function getExistingSidebarBanner(config) {
|
|
55
|
+
if (!config.sidebar || config.sidebar === true) return void 0;
|
|
56
|
+
return config.sidebar.banner;
|
|
57
|
+
}
|
|
58
|
+
function mergeBanner(existing, next) {
|
|
59
|
+
if (!existing) return next;
|
|
60
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
61
|
+
style: {
|
|
62
|
+
display: "flex",
|
|
63
|
+
flexDirection: "column",
|
|
64
|
+
gap: 12
|
|
65
|
+
},
|
|
66
|
+
children: [existing, next]
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
function withNextApiReferenceBanner(config) {
|
|
70
|
+
const apiReference = resolveApiReferenceConfig(config.apiReference);
|
|
71
|
+
if (!apiReference.enabled) return config;
|
|
72
|
+
if (config.sidebar === false) return config;
|
|
73
|
+
const switcher = /* @__PURE__ */ jsx(ApiReferenceSwitcher, {
|
|
74
|
+
docsUrl: getDocsUrl(config),
|
|
75
|
+
apiUrl: `/${apiReference.path}`,
|
|
76
|
+
current: "docs",
|
|
77
|
+
config
|
|
78
|
+
});
|
|
79
|
+
const banner = mergeBanner(getExistingSidebarBanner(config), switcher);
|
|
80
|
+
if (!config.sidebar || config.sidebar === true) return {
|
|
81
|
+
...config,
|
|
82
|
+
sidebar: { banner }
|
|
83
|
+
};
|
|
84
|
+
return {
|
|
85
|
+
...config,
|
|
86
|
+
sidebar: {
|
|
87
|
+
...config.sidebar,
|
|
88
|
+
banner
|
|
89
|
+
}
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
//#endregion
|
|
94
|
+
export { withNextApiReferenceBanner as a, mergeBanner as i, getDocsUrl as n, getExistingSidebarBanner as r, ApiReferenceSwitcher as t };
|
package/dist/api-reference.d.mts
CHANGED
|
@@ -1,46 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
//#region src/api-reference.d.ts
|
|
6
|
-
interface NextApiReferenceSourceState {
|
|
7
|
-
apiReference: ReturnType<typeof resolveApiReferenceConfig>;
|
|
8
|
-
document: Record<string, unknown>;
|
|
9
|
-
info: {
|
|
10
|
-
title: string;
|
|
11
|
-
description?: string;
|
|
12
|
-
};
|
|
13
|
-
primaryServerUrl?: string;
|
|
14
|
-
pages: Array<{
|
|
15
|
-
url: string;
|
|
16
|
-
} & Record<string, any>>;
|
|
17
|
-
server: any;
|
|
18
|
-
source: {
|
|
19
|
-
getPage: (slug?: string[]) => any;
|
|
20
|
-
getPages: () => Array<any>;
|
|
21
|
-
getPageTree: () => any;
|
|
22
|
-
};
|
|
23
|
-
}
|
|
24
|
-
declare function buildNextOpenApiDocument(config: DocsConfig): Record<string, unknown>;
|
|
25
|
-
declare function flattenApiReferencePageTreeForSidebar(tree: any): any;
|
|
26
|
-
declare function withNextApiReferenceBanner(config: DocsConfig): DocsConfig;
|
|
27
|
-
declare function createNextApiReference(config: DocsConfig): (request?: Request) => Promise<Response>;
|
|
28
|
-
declare function createNextApiReferencePage(config: DocsConfig): (props?: {
|
|
29
|
-
params?: Promise<{
|
|
30
|
-
slug?: string[];
|
|
31
|
-
}> | {
|
|
32
|
-
slug?: string[];
|
|
33
|
-
};
|
|
34
|
-
}) => Promise<react_jsx_runtime0.JSX.Element>;
|
|
35
|
-
declare function createNextApiReferenceLayout(config: DocsConfig): (props: {
|
|
36
|
-
children: React.ReactNode;
|
|
37
|
-
params?: Promise<{
|
|
38
|
-
slug?: string[];
|
|
39
|
-
}> | {
|
|
40
|
-
slug?: string[];
|
|
41
|
-
};
|
|
42
|
-
}) => Promise<react_jsx_runtime0.JSX.Element>;
|
|
43
|
-
declare function getNextApiReferenceSourceState(config: DocsConfig, versionId?: string): Promise<NextApiReferenceSourceState>;
|
|
44
|
-
declare function getNextApiReferenceMode(config: DocsConfig): "farming-labs" | "fumadocs" | "scalar";
|
|
45
|
-
//#endregion
|
|
46
|
-
export { NextApiReferenceSourceState, buildNextOpenApiDocument, createNextApiReference, createNextApiReferenceLayout, createNextApiReferencePage, flattenApiReferencePageTreeForSidebar, getNextApiReferenceMode, getNextApiReferenceSourceState, resolveApiReferenceConfig, withNextApiReferenceBanner };
|
|
1
|
+
import { a as createNextApiReferencePage, c as getNextApiReferenceSourceState, i as createNextApiReferenceLayout, l as resolveApiReferenceConfig, n as buildNextOpenApiDocument, o as flattenApiReferencePageTreeForSidebar, r as createNextApiReference, s as getNextApiReferenceMode, t as NextApiReferenceSourceState, u as withNextApiReferenceBanner } from "./api-reference-CTAOPJih.mjs";
|
|
2
|
+
import { FumadocsApiReferenceRendererOptions, fumadocsRenderer } from "./fumadocs-renderer.mjs";
|
|
3
|
+
export { FumadocsApiReferenceRendererOptions, NextApiReferenceSourceState, buildNextOpenApiDocument, createNextApiReference, createNextApiReferenceLayout, createNextApiReferencePage, flattenApiReferencePageTreeForSidebar, fumadocsRenderer, getNextApiReferenceMode, getNextApiReferenceSourceState, resolveApiReferenceConfig, withNextApiReferenceBanner };
|
package/dist/api-reference.mjs
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import DocsClientCallbacks from "./client-callbacks.mjs";
|
|
2
2
|
import FumadocsOpenAPIPage from "./fumadocs-api-page.mjs";
|
|
3
|
+
import { a as withNextApiReferenceBanner, i as mergeBanner, n as getDocsUrl, r as getExistingSidebarBanner, t as ApiReferenceSwitcher } from "./api-reference-banner-q98BnSRL.mjs";
|
|
4
|
+
import { fumadocsRenderer } from "./fumadocs-renderer.mjs";
|
|
3
5
|
import { existsSync, readFileSync, readdirSync, statSync } from "node:fs";
|
|
4
6
|
import { join, relative } from "node:path";
|
|
5
|
-
import { resolveDocsMetadataBaseUrl } from "@farming-labs/docs";
|
|
6
7
|
import { ApiReference } from "@scalar/nextjs-api-reference";
|
|
8
|
+
import { resolveDocsMetadataBaseUrl } from "@farming-labs/docs";
|
|
7
9
|
import { buildApiReferenceHtmlDocumentAsync, buildApiReferenceOpenApiDocumentAsync, buildApiReferencePageTitle, buildApiReferenceScalarCss, createApiReferenceOperationMarkdownResponse, resolveApiReferenceConfig, resolveApiReferenceRenderer, resolveApiReferenceVersion, resolveApiReferenceVersionFromPathname } from "@farming-labs/docs/runtime";
|
|
8
|
-
import { SidebarTabsDropdown } from "fumadocs-ui/components/sidebar/tabs/dropdown";
|
|
9
10
|
import Link from "next/link";
|
|
10
11
|
import { notFound } from "next/navigation";
|
|
11
12
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
@@ -121,10 +122,6 @@ function scanRouteFiles(dir) {
|
|
|
121
122
|
}
|
|
122
123
|
return results;
|
|
123
124
|
}
|
|
124
|
-
function getDocsUrl(config) {
|
|
125
|
-
if (typeof config.nav?.url === "string") return config.nav.url;
|
|
126
|
-
return `/${config.entry ?? "docs"}`;
|
|
127
|
-
}
|
|
128
125
|
function getForcedMode(config) {
|
|
129
126
|
const toggle = config.themeToggle;
|
|
130
127
|
if (!toggle || typeof toggle !== "object") return void 0;
|
|
@@ -300,34 +297,6 @@ function buildNextOpenApiDocument(config) {
|
|
|
300
297
|
paths: buildOpenApiPaths(routes)
|
|
301
298
|
};
|
|
302
299
|
}
|
|
303
|
-
function SwitcherGlyph({ kind }) {
|
|
304
|
-
const isApi = kind === "api";
|
|
305
|
-
return /* @__PURE__ */ jsx("span", {
|
|
306
|
-
className: "fd-api-reference-switcher-glyph",
|
|
307
|
-
"data-kind": kind,
|
|
308
|
-
"aria-hidden": "true",
|
|
309
|
-
children: isApi ? /* @__PURE__ */ jsx("svg", {
|
|
310
|
-
viewBox: "0 0 24 24",
|
|
311
|
-
fill: "none",
|
|
312
|
-
children: /* @__PURE__ */ jsx("path", {
|
|
313
|
-
d: "M8 8L4 12L8 16M16 8L20 12L16 16M13.5 6L10.5 18",
|
|
314
|
-
stroke: "currentColor",
|
|
315
|
-
strokeWidth: "1.8",
|
|
316
|
-
strokeLinecap: "round",
|
|
317
|
-
strokeLinejoin: "round"
|
|
318
|
-
})
|
|
319
|
-
}) : /* @__PURE__ */ jsx("svg", {
|
|
320
|
-
viewBox: "0 0 24 24",
|
|
321
|
-
fill: "none",
|
|
322
|
-
children: /* @__PURE__ */ jsx("path", {
|
|
323
|
-
d: "M4.75 6.75C4.75 5.64543 5.64543 4.75 6.75 4.75H11.25V19.25H6.75C5.64543 19.25 4.75 18.3546 4.75 17.25V6.75ZM12.75 4.75H17.25C18.3546 4.75 19.25 5.64543 19.25 6.75V17.25C19.25 18.3546 18.3546 19.25 17.25 19.25H12.75V4.75Z",
|
|
324
|
-
stroke: "currentColor",
|
|
325
|
-
strokeWidth: "1.8",
|
|
326
|
-
strokeLinejoin: "round"
|
|
327
|
-
})
|
|
328
|
-
})
|
|
329
|
-
});
|
|
330
|
-
}
|
|
331
300
|
const API_REFERENCE_COLOR_MAP = {
|
|
332
301
|
primary: "--color-fd-primary",
|
|
333
302
|
primaryForeground: "--color-fd-primary-foreground",
|
|
@@ -489,40 +458,9 @@ function ApiReferenceServerUrlPatchScript({ serverUrl }) {
|
|
|
489
458
|
})();` }
|
|
490
459
|
});
|
|
491
460
|
}
|
|
492
|
-
function ApiReferenceSwitcher({ docsUrl, apiUrl }) {
|
|
493
|
-
return /* @__PURE__ */ jsx(SidebarTabsDropdown, {
|
|
494
|
-
className: "fd-api-reference-switcher w-full mb-4",
|
|
495
|
-
options: [{
|
|
496
|
-
url: docsUrl,
|
|
497
|
-
title: "Documentation",
|
|
498
|
-
description: "Guides & concepts",
|
|
499
|
-
icon: /* @__PURE__ */ jsx(SwitcherGlyph, { kind: "docs" })
|
|
500
|
-
}, {
|
|
501
|
-
url: apiUrl,
|
|
502
|
-
title: "API Reference",
|
|
503
|
-
description: "Endpoints & examples",
|
|
504
|
-
icon: /* @__PURE__ */ jsx(SwitcherGlyph, { kind: "api" })
|
|
505
|
-
}]
|
|
506
|
-
});
|
|
507
|
-
}
|
|
508
|
-
function getExistingSidebarBanner(config) {
|
|
509
|
-
if (!config.sidebar || config.sidebar === true) return void 0;
|
|
510
|
-
return config.sidebar.banner;
|
|
511
|
-
}
|
|
512
461
|
function resolveApiReferenceThemeStyle(config) {
|
|
513
462
|
if ((config.theme?.name?.toLowerCase() ?? "").includes("colorful")) return "colorful";
|
|
514
463
|
}
|
|
515
|
-
function mergeBanner(existing, next) {
|
|
516
|
-
if (!existing) return next;
|
|
517
|
-
return /* @__PURE__ */ jsxs("div", {
|
|
518
|
-
style: {
|
|
519
|
-
display: "flex",
|
|
520
|
-
flexDirection: "column",
|
|
521
|
-
gap: 12
|
|
522
|
-
},
|
|
523
|
-
children: [existing, next]
|
|
524
|
-
});
|
|
525
|
-
}
|
|
526
464
|
function flattenApiReferencePageTreeForSidebar(tree) {
|
|
527
465
|
if (!tree || typeof tree !== "object") return tree;
|
|
528
466
|
const root = tree;
|
|
@@ -538,29 +476,6 @@ function flattenApiReferencePageTreeForSidebar(tree) {
|
|
|
538
476
|
children: nextChildren
|
|
539
477
|
};
|
|
540
478
|
}
|
|
541
|
-
function withNextApiReferenceBanner(config) {
|
|
542
|
-
const apiReference = resolveApiReferenceConfig(config.apiReference);
|
|
543
|
-
if (!apiReference.enabled) return config;
|
|
544
|
-
if (config.sidebar === false) return config;
|
|
545
|
-
const switcher = /* @__PURE__ */ jsx(ApiReferenceSwitcher, {
|
|
546
|
-
docsUrl: getDocsUrl(config),
|
|
547
|
-
apiUrl: `/${apiReference.path}`,
|
|
548
|
-
current: "docs",
|
|
549
|
-
config
|
|
550
|
-
});
|
|
551
|
-
const banner = mergeBanner(getExistingSidebarBanner(config), switcher);
|
|
552
|
-
if (!config.sidebar || config.sidebar === true) return {
|
|
553
|
-
...config,
|
|
554
|
-
sidebar: { banner }
|
|
555
|
-
};
|
|
556
|
-
return {
|
|
557
|
-
...config,
|
|
558
|
-
sidebar: {
|
|
559
|
-
...config.sidebar,
|
|
560
|
-
banner
|
|
561
|
-
}
|
|
562
|
-
};
|
|
563
|
-
}
|
|
564
479
|
function createNextApiReference(config) {
|
|
565
480
|
const apiReference = resolveApiReferenceConfig(config.apiReference);
|
|
566
481
|
return async (request) => {
|
|
@@ -766,7 +681,12 @@ async function getNextApiReferenceSourceState(config, versionId) {
|
|
|
766
681
|
baseUrl,
|
|
767
682
|
version: version?.id
|
|
768
683
|
});
|
|
769
|
-
const
|
|
684
|
+
const fumadocsOptions = apiReference.renderer === "fumadocs" ? apiReference.rendererOptions : void 0;
|
|
685
|
+
const server = createOpenAPI({
|
|
686
|
+
input: { main: document },
|
|
687
|
+
disableCache: typeof fumadocsOptions?.disableCache === "boolean" ? fumadocsOptions.disableCache : void 0,
|
|
688
|
+
proxyUrl: typeof fumadocsOptions?.proxyUrl === "string" ? fumadocsOptions.proxyUrl : void 0
|
|
689
|
+
});
|
|
770
690
|
const info = getOpenApiInfo(document);
|
|
771
691
|
const source = loader(await openapiSource(server, {
|
|
772
692
|
per: "operation",
|
|
@@ -795,4 +715,4 @@ function getNextApiReferenceMode(config) {
|
|
|
795
715
|
}
|
|
796
716
|
|
|
797
717
|
//#endregion
|
|
798
|
-
export { buildNextOpenApiDocument, createNextApiReference, createNextApiReferenceLayout, createNextApiReferencePage, flattenApiReferencePageTreeForSidebar, getNextApiReferenceMode, getNextApiReferenceSourceState, resolveApiReferenceConfig, withNextApiReferenceBanner };
|
|
718
|
+
export { buildNextOpenApiDocument, createNextApiReference, createNextApiReferenceLayout, createNextApiReferencePage, flattenApiReferencePageTreeForSidebar, fumadocsRenderer, getNextApiReferenceMode, getNextApiReferenceSourceState, resolveApiReferenceConfig, withNextApiReferenceBanner };
|