@farming-labs/next 0.2.118 → 0.2.119

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.
@@ -1,4 +1,5 @@
1
1
  import DocsClientCallbacks from "./client-callbacks.mjs";
2
+ import FumadocsOpenAPIPage from "./fumadocs-api-page.mjs";
2
3
  import { existsSync, readFileSync, readdirSync, statSync } from "node:fs";
3
4
  import { join, relative } from "node:path";
4
5
  import { resolveDocsMetadataBaseUrl } from "@farming-labs/docs";
@@ -537,30 +538,6 @@ function flattenApiReferencePageTreeForSidebar(tree) {
537
538
  children: nextChildren
538
539
  };
539
540
  }
540
- function renderApiReferenceOperationLayout(slots) {
541
- return /* @__PURE__ */ jsxs("div", {
542
- className: "fd-api-reference-operation",
543
- children: [/* @__PURE__ */ jsxs("div", {
544
- className: "fd-api-reference-operation-main",
545
- children: [
546
- slots.header,
547
- slots.apiPlayground,
548
- slots.description ? /* @__PURE__ */ jsx("div", {
549
- className: "fd-api-reference-operation-description",
550
- children: slots.description
551
- }) : null,
552
- slots.authSchemes,
553
- slots.parameters,
554
- slots.body,
555
- slots.responses,
556
- slots.callbacks
557
- ]
558
- }), slots.apiExample ? /* @__PURE__ */ jsx("div", {
559
- className: "fd-api-reference-operation-example",
560
- children: slots.apiExample
561
- }) : null]
562
- });
563
- }
564
541
  function withNextApiReferenceBanner(config) {
565
542
  const apiReference = resolveApiReferenceConfig(config.apiReference);
566
543
  if (!apiReference.enabled) return config;
@@ -651,11 +628,11 @@ function getOpenApiInfo(document) {
651
628
  }
652
629
  function createNextApiReferencePage(config) {
653
630
  return async function NextApiReferencePage(props) {
654
- const [{ createAPIPage }, { DocsDescription, DocsPage, DocsTitle }] = await Promise.all([import("fumadocs-openapi/ui"), import("fumadocs-ui/layouts/notebook/page")]);
631
+ const { DocsDescription, DocsPage, DocsTitle } = await import("fumadocs-ui/layouts/notebook/page");
655
632
  const slug = (props?.params ? await props.params : void 0)?.slug ?? [];
656
633
  const version = resolveApiReferenceVersion(resolveApiReferenceConfig(config.apiReference), slug[0]);
657
634
  const pageSlug = version ? slug.slice(1) : slug;
658
- const { info, pages, server, source } = await getNextApiReferenceSourceState(config, version?.id);
635
+ const { info, pages, source } = await getNextApiReferenceSourceState(config, version?.id);
659
636
  if (pages.length === 0) return /* @__PURE__ */ jsxs(DocsPage, {
660
637
  full: true,
661
638
  children: [
@@ -671,8 +648,7 @@ function createNextApiReferencePage(config) {
671
648
  ]
672
649
  });
673
650
  const page = pageSlug.length === 0 ? pages[0] : source.getPage(pageSlug);
674
- if (!page || typeof page.data?.getAPIPageProps !== "function") notFound();
675
- const APIPage = createAPIPage(server, { content: { renderOperationLayout: renderApiReferenceOperationLayout } });
651
+ if (!page || typeof page.data?.getOpenAPIPageProps !== "function") notFound();
676
652
  const currentPageIndex = pageSlug.length === 0 ? 0 : pages.findIndex((entry) => entry.url === page.url);
677
653
  const previousPage = currentPageIndex > 0 ? pages[currentPageIndex - 1] : void 0;
678
654
  const nextPage = currentPageIndex >= 0 && currentPageIndex < pages.length - 1 ? pages[currentPageIndex + 1] : void 0;
@@ -686,7 +662,7 @@ function createNextApiReferencePage(config) {
686
662
  /* @__PURE__ */ jsx(DocsDescription, { children: typeof page.data.description === "string" && page.data.description.trim() ? page.data.description : info.description }),
687
663
  /* @__PURE__ */ jsx("div", {
688
664
  className: "fd-api-reference-body",
689
- children: /* @__PURE__ */ jsx(APIPage, { ...page.data.getAPIPageProps() })
665
+ children: /* @__PURE__ */ jsx(FumadocsOpenAPIPage, { ...page.data.getOpenAPIPageProps() })
690
666
  }),
691
667
  previousPage || nextPage ? /* @__PURE__ */ jsxs("nav", {
692
668
  className: "fd-api-reference-pagination",
@@ -790,14 +766,14 @@ async function getNextApiReferenceSourceState(config, versionId) {
790
766
  baseUrl,
791
767
  version: version?.id
792
768
  });
793
- const server = createOpenAPI({ input: async () => ({ main: document }) });
769
+ const server = createOpenAPI({ input: { main: document } });
794
770
  const info = getOpenApiInfo(document);
795
771
  const source = loader(await openapiSource(server, {
796
772
  per: "operation",
797
773
  groupBy: "tag",
798
- name(output, dereferenced) {
774
+ name(output) {
799
775
  if (output.type !== "operation") return slugifyApiReferencePageName(output.item.name);
800
- const operation = (dereferenced.paths?.[output.item.path])?.[output.item.method];
776
+ const operation = (this.document?.paths?.[output.item.path])?.[output.item.method];
801
777
  return slugifyApiReferencePageName(typeof operation?.summary === "string" && operation.summary.trim() ? operation.summary : typeof operation?.operationId === "string" && operation.operationId.trim() ? operation.operationId : `${output.item.method} ${output.item.path}`);
802
778
  }
803
779
  }), {
@@ -0,0 +1,8 @@
1
+ import * as react from "react";
2
+ import * as fumadocs_openapi_ui0 from "fumadocs-openapi/ui";
3
+
4
+ //#region src/fumadocs-api-page.d.ts
5
+ /** Client boundary for Fumadocs OpenAPI's interactive renderer. */
6
+ declare const FumadocsOpenAPIPage: react.FC<fumadocs_openapi_ui0.OpenAPIPageProps>;
7
+ //#endregion
8
+ export { FumadocsOpenAPIPage as default };
@@ -0,0 +1,35 @@
1
+ "use client";
2
+
3
+ import { jsx, jsxs } from "react/jsx-runtime";
4
+ import { createOpenAPIPage } from "fumadocs-openapi/ui";
5
+
6
+ //#region src/fumadocs-api-page.tsx
7
+ function renderApiReferenceOperationLayout(slots) {
8
+ return /* @__PURE__ */ jsxs("div", {
9
+ className: "fd-api-reference-operation",
10
+ children: [/* @__PURE__ */ jsxs("div", {
11
+ className: "fd-api-reference-operation-main",
12
+ children: [
13
+ slots.header,
14
+ slots.apiPlayground,
15
+ slots.description ? /* @__PURE__ */ jsx("div", {
16
+ className: "fd-api-reference-operation-description",
17
+ children: slots.description
18
+ }) : null,
19
+ slots.authSchemes,
20
+ slots.parameters,
21
+ slots.body,
22
+ slots.responses,
23
+ slots.callbacks
24
+ ]
25
+ }), slots.apiExample ? /* @__PURE__ */ jsx("div", {
26
+ className: "fd-api-reference-operation-example",
27
+ children: slots.apiExample
28
+ }) : null]
29
+ });
30
+ }
31
+ /** Client boundary for Fumadocs OpenAPI's interactive renderer. */
32
+ const FumadocsOpenAPIPage = createOpenAPIPage({ content: { renderOperationLayout: renderApiReferenceOperationLayout } });
33
+
34
+ //#endregion
35
+ export { FumadocsOpenAPIPage as default };
package/dist/layout.mjs CHANGED
@@ -79,7 +79,7 @@ function createNextDocsMetadata(config) {
79
79
  }
80
80
  function createNextDocsLayout(config) {
81
81
  emitDocsTelemetryProjectEvent(config, { framework: "next" });
82
- const DocsLayout = createDocsLayout(withNextApiReferenceBanner(config));
82
+ const DocsLayout = createDocsLayout(withNextApiReferenceBanner(config), { telemetryFramework: "next" });
83
83
  return function NextDocsLayout({ children }) {
84
84
  const docsCloud = resolveNextDocsCloudClientOptions(config);
85
85
  return /* @__PURE__ */ jsxs(Fragment, { children: [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@farming-labs/next",
3
- "version": "0.2.118",
3
+ "version": "0.2.119",
4
4
  "description": "Next.js adapter for @farming-labs/docs — MDX config wrapper",
5
5
  "keywords": [
6
6
  "docs",
@@ -91,9 +91,9 @@
91
91
  "@mdx-js/react": "^3.1.0",
92
92
  "@next/mdx": "^16.1.6",
93
93
  "@scalar/nextjs-api-reference": "0.10.3",
94
- "fumadocs-openapi": "10.7.0",
95
- "fumadocs-core": "16.7.16",
96
- "fumadocs-ui": "16.7.16",
94
+ "fumadocs-core": "16.17.1",
95
+ "fumadocs-openapi": "12.4.1",
96
+ "fumadocs-ui": "16.17.1",
97
97
  "gray-matter": "^4.0.3",
98
98
  "remark-frontmatter": "^5.0.0",
99
99
  "remark-gfm": "^4.0.1",
@@ -109,8 +109,8 @@
109
109
  "tsdown": "^0.20.3",
110
110
  "typescript": "^5.9.3",
111
111
  "vitest": "^4.1.8",
112
- "@farming-labs/docs": "0.2.118",
113
- "@farming-labs/theme": "0.2.118"
112
+ "@farming-labs/docs": "0.2.119",
113
+ "@farming-labs/theme": "0.2.119"
114
114
  },
115
115
  "peerDependencies": {
116
116
  "@farming-labs/docs": ">=0.2.73",