@farming-labs/next 0.2.120 → 0.2.122
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 +2 -46
- package/dist/api-reference.mjs +2 -88
- package/dist/config-woF1rXS1.mjs +2345 -0
- package/dist/config-yzp9kyZ0.d.mts +21 -0
- package/dist/config.d.mts +2 -7
- package/dist/config.mjs +1 -2256
- package/dist/core-DRyvBL8l.mjs +16 -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 +4 -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,47 +1,3 @@
|
|
|
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";
|
|
1
2
|
import { FumadocsApiReferenceRendererOptions, fumadocsRenderer } from "./fumadocs-renderer.mjs";
|
|
2
|
-
|
|
3
|
-
import { resolveApiReferenceConfig } from "@farming-labs/docs/runtime";
|
|
4
|
-
import * as react_jsx_runtime0 from "react/jsx-runtime";
|
|
5
|
-
|
|
6
|
-
//#region src/api-reference.d.ts
|
|
7
|
-
interface NextApiReferenceSourceState {
|
|
8
|
-
apiReference: ReturnType<typeof resolveApiReferenceConfig>;
|
|
9
|
-
document: Record<string, unknown>;
|
|
10
|
-
info: {
|
|
11
|
-
title: string;
|
|
12
|
-
description?: string;
|
|
13
|
-
};
|
|
14
|
-
primaryServerUrl?: string;
|
|
15
|
-
pages: Array<{
|
|
16
|
-
url: string;
|
|
17
|
-
} & Record<string, any>>;
|
|
18
|
-
server: any;
|
|
19
|
-
source: {
|
|
20
|
-
getPage: (slug?: string[]) => any;
|
|
21
|
-
getPages: () => Array<any>;
|
|
22
|
-
getPageTree: () => any;
|
|
23
|
-
};
|
|
24
|
-
}
|
|
25
|
-
declare function buildNextOpenApiDocument(config: DocsConfig): Record<string, unknown>;
|
|
26
|
-
declare function flattenApiReferencePageTreeForSidebar(tree: any): any;
|
|
27
|
-
declare function withNextApiReferenceBanner(config: DocsConfig): DocsConfig;
|
|
28
|
-
declare function createNextApiReference(config: DocsConfig): (request?: Request) => Promise<Response>;
|
|
29
|
-
declare function createNextApiReferencePage(config: DocsConfig): (props?: {
|
|
30
|
-
params?: Promise<{
|
|
31
|
-
slug?: string[];
|
|
32
|
-
}> | {
|
|
33
|
-
slug?: string[];
|
|
34
|
-
};
|
|
35
|
-
}) => Promise<react_jsx_runtime0.JSX.Element>;
|
|
36
|
-
declare function createNextApiReferenceLayout(config: DocsConfig): (props: {
|
|
37
|
-
children: React.ReactNode;
|
|
38
|
-
params?: Promise<{
|
|
39
|
-
slug?: string[];
|
|
40
|
-
}> | {
|
|
41
|
-
slug?: string[];
|
|
42
|
-
};
|
|
43
|
-
}) => Promise<react_jsx_runtime0.JSX.Element>;
|
|
44
|
-
declare function getNextApiReferenceSourceState(config: DocsConfig, versionId?: string): Promise<NextApiReferenceSourceState>;
|
|
45
|
-
declare function getNextApiReferenceMode(config: DocsConfig): "farming-labs" | "fumadocs" | "scalar";
|
|
46
|
-
//#endregion
|
|
47
|
-
export { type FumadocsApiReferenceRendererOptions, NextApiReferenceSourceState, buildNextOpenApiDocument, createNextApiReference, createNextApiReferenceLayout, createNextApiReferencePage, flattenApiReferencePageTreeForSidebar, fumadocsRenderer, getNextApiReferenceMode, getNextApiReferenceSourceState, resolveApiReferenceConfig, withNextApiReferenceBanner };
|
|
3
|
+
export { FumadocsApiReferenceRendererOptions, NextApiReferenceSourceState, buildNextOpenApiDocument, createNextApiReference, createNextApiReferenceLayout, createNextApiReferencePage, flattenApiReferencePageTreeForSidebar, fumadocsRenderer, getNextApiReferenceMode, getNextApiReferenceSourceState, resolveApiReferenceConfig, withNextApiReferenceBanner };
|
package/dist/api-reference.mjs
CHANGED
|
@@ -1,12 +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";
|
|
3
4
|
import { fumadocsRenderer } from "./fumadocs-renderer.mjs";
|
|
4
5
|
import { existsSync, readFileSync, readdirSync, statSync } from "node:fs";
|
|
5
6
|
import { join, relative } from "node:path";
|
|
6
|
-
import { resolveDocsMetadataBaseUrl } from "@farming-labs/docs";
|
|
7
7
|
import { ApiReference } from "@scalar/nextjs-api-reference";
|
|
8
|
+
import { resolveDocsMetadataBaseUrl } from "@farming-labs/docs";
|
|
8
9
|
import { buildApiReferenceHtmlDocumentAsync, buildApiReferenceOpenApiDocumentAsync, buildApiReferencePageTitle, buildApiReferenceScalarCss, createApiReferenceOperationMarkdownResponse, resolveApiReferenceConfig, resolveApiReferenceRenderer, resolveApiReferenceVersion, resolveApiReferenceVersionFromPathname } from "@farming-labs/docs/runtime";
|
|
9
|
-
import { SidebarTabsDropdown } from "fumadocs-ui/components/sidebar/tabs/dropdown";
|
|
10
10
|
import Link from "next/link";
|
|
11
11
|
import { notFound } from "next/navigation";
|
|
12
12
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
@@ -122,10 +122,6 @@ function scanRouteFiles(dir) {
|
|
|
122
122
|
}
|
|
123
123
|
return results;
|
|
124
124
|
}
|
|
125
|
-
function getDocsUrl(config) {
|
|
126
|
-
if (typeof config.nav?.url === "string") return config.nav.url;
|
|
127
|
-
return `/${config.entry ?? "docs"}`;
|
|
128
|
-
}
|
|
129
125
|
function getForcedMode(config) {
|
|
130
126
|
const toggle = config.themeToggle;
|
|
131
127
|
if (!toggle || typeof toggle !== "object") return void 0;
|
|
@@ -301,34 +297,6 @@ function buildNextOpenApiDocument(config) {
|
|
|
301
297
|
paths: buildOpenApiPaths(routes)
|
|
302
298
|
};
|
|
303
299
|
}
|
|
304
|
-
function SwitcherGlyph({ kind }) {
|
|
305
|
-
const isApi = kind === "api";
|
|
306
|
-
return /* @__PURE__ */ jsx("span", {
|
|
307
|
-
className: "fd-api-reference-switcher-glyph",
|
|
308
|
-
"data-kind": kind,
|
|
309
|
-
"aria-hidden": "true",
|
|
310
|
-
children: isApi ? /* @__PURE__ */ jsx("svg", {
|
|
311
|
-
viewBox: "0 0 24 24",
|
|
312
|
-
fill: "none",
|
|
313
|
-
children: /* @__PURE__ */ jsx("path", {
|
|
314
|
-
d: "M8 8L4 12L8 16M16 8L20 12L16 16M13.5 6L10.5 18",
|
|
315
|
-
stroke: "currentColor",
|
|
316
|
-
strokeWidth: "1.8",
|
|
317
|
-
strokeLinecap: "round",
|
|
318
|
-
strokeLinejoin: "round"
|
|
319
|
-
})
|
|
320
|
-
}) : /* @__PURE__ */ jsx("svg", {
|
|
321
|
-
viewBox: "0 0 24 24",
|
|
322
|
-
fill: "none",
|
|
323
|
-
children: /* @__PURE__ */ jsx("path", {
|
|
324
|
-
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",
|
|
325
|
-
stroke: "currentColor",
|
|
326
|
-
strokeWidth: "1.8",
|
|
327
|
-
strokeLinejoin: "round"
|
|
328
|
-
})
|
|
329
|
-
})
|
|
330
|
-
});
|
|
331
|
-
}
|
|
332
300
|
const API_REFERENCE_COLOR_MAP = {
|
|
333
301
|
primary: "--color-fd-primary",
|
|
334
302
|
primaryForeground: "--color-fd-primary-foreground",
|
|
@@ -490,40 +458,9 @@ function ApiReferenceServerUrlPatchScript({ serverUrl }) {
|
|
|
490
458
|
})();` }
|
|
491
459
|
});
|
|
492
460
|
}
|
|
493
|
-
function ApiReferenceSwitcher({ docsUrl, apiUrl }) {
|
|
494
|
-
return /* @__PURE__ */ jsx(SidebarTabsDropdown, {
|
|
495
|
-
className: "fd-api-reference-switcher w-full mb-4",
|
|
496
|
-
options: [{
|
|
497
|
-
url: docsUrl,
|
|
498
|
-
title: "Documentation",
|
|
499
|
-
description: "Guides & concepts",
|
|
500
|
-
icon: /* @__PURE__ */ jsx(SwitcherGlyph, { kind: "docs" })
|
|
501
|
-
}, {
|
|
502
|
-
url: apiUrl,
|
|
503
|
-
title: "API Reference",
|
|
504
|
-
description: "Endpoints & examples",
|
|
505
|
-
icon: /* @__PURE__ */ jsx(SwitcherGlyph, { kind: "api" })
|
|
506
|
-
}]
|
|
507
|
-
});
|
|
508
|
-
}
|
|
509
|
-
function getExistingSidebarBanner(config) {
|
|
510
|
-
if (!config.sidebar || config.sidebar === true) return void 0;
|
|
511
|
-
return config.sidebar.banner;
|
|
512
|
-
}
|
|
513
461
|
function resolveApiReferenceThemeStyle(config) {
|
|
514
462
|
if ((config.theme?.name?.toLowerCase() ?? "").includes("colorful")) return "colorful";
|
|
515
463
|
}
|
|
516
|
-
function mergeBanner(existing, next) {
|
|
517
|
-
if (!existing) return next;
|
|
518
|
-
return /* @__PURE__ */ jsxs("div", {
|
|
519
|
-
style: {
|
|
520
|
-
display: "flex",
|
|
521
|
-
flexDirection: "column",
|
|
522
|
-
gap: 12
|
|
523
|
-
},
|
|
524
|
-
children: [existing, next]
|
|
525
|
-
});
|
|
526
|
-
}
|
|
527
464
|
function flattenApiReferencePageTreeForSidebar(tree) {
|
|
528
465
|
if (!tree || typeof tree !== "object") return tree;
|
|
529
466
|
const root = tree;
|
|
@@ -539,29 +476,6 @@ function flattenApiReferencePageTreeForSidebar(tree) {
|
|
|
539
476
|
children: nextChildren
|
|
540
477
|
};
|
|
541
478
|
}
|
|
542
|
-
function withNextApiReferenceBanner(config) {
|
|
543
|
-
const apiReference = resolveApiReferenceConfig(config.apiReference);
|
|
544
|
-
if (!apiReference.enabled) return config;
|
|
545
|
-
if (config.sidebar === false) return config;
|
|
546
|
-
const switcher = /* @__PURE__ */ jsx(ApiReferenceSwitcher, {
|
|
547
|
-
docsUrl: getDocsUrl(config),
|
|
548
|
-
apiUrl: `/${apiReference.path}`,
|
|
549
|
-
current: "docs",
|
|
550
|
-
config
|
|
551
|
-
});
|
|
552
|
-
const banner = mergeBanner(getExistingSidebarBanner(config), switcher);
|
|
553
|
-
if (!config.sidebar || config.sidebar === true) return {
|
|
554
|
-
...config,
|
|
555
|
-
sidebar: { banner }
|
|
556
|
-
};
|
|
557
|
-
return {
|
|
558
|
-
...config,
|
|
559
|
-
sidebar: {
|
|
560
|
-
...config.sidebar,
|
|
561
|
-
banner
|
|
562
|
-
}
|
|
563
|
-
};
|
|
564
|
-
}
|
|
565
479
|
function createNextApiReference(config) {
|
|
566
480
|
const apiReference = resolveApiReferenceConfig(config.apiReference);
|
|
567
481
|
return async (request) => {
|