fumadocs-openapi 5.4.4 → 5.4.6
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/server/index.js +51 -54
- package/package.json +14 -14
package/dist/server/index.js
CHANGED
|
@@ -1,17 +1,19 @@
|
|
|
1
|
-
import { jsx, jsxs, Fragment
|
|
1
|
+
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
2
2
|
import Slugger from 'github-slugger';
|
|
3
3
|
import Parser from '@apidevtools/json-schema-ref-parser';
|
|
4
|
-
import {
|
|
4
|
+
import { Fragment as Fragment$1 } from 'react';
|
|
5
5
|
import { sample } from 'openapi-sampler';
|
|
6
|
-
import { compile } from 'json-schema-to-typescript';
|
|
7
|
-
import {
|
|
8
|
-
import { remarkGfm, rehypeCode } from 'fumadocs-core/mdx-plugins';
|
|
6
|
+
import { compile } from '@fumari/json-schema-to-typescript';
|
|
7
|
+
import { remarkGfm, remarkImage, rehypeCode } from 'fumadocs-core/mdx-plugins';
|
|
9
8
|
import defaultMdxComponents from 'fumadocs-ui/mdx';
|
|
9
|
+
import { remark } from 'remark';
|
|
10
|
+
import remarkRehype from 'remark-rehype';
|
|
11
|
+
import { toJsxRuntime } from 'hast-util-to-jsx-runtime';
|
|
10
12
|
import { Heading } from 'fumadocs-ui/components/heading';
|
|
11
13
|
import { Tabs, Tab } from 'fumadocs-ui/components/tabs';
|
|
12
14
|
import { Accordions, Accordion } from 'fumadocs-ui/components/accordion';
|
|
13
15
|
import * as Base from 'fumadocs-ui/components/codeblock';
|
|
14
|
-
import {
|
|
16
|
+
import { codeToHast } from 'shiki';
|
|
15
17
|
import { Root, API, APIInfo, APIExample as APIExample$1, Property, ObjectCollapsible, APIPlayground } from '../ui/index.js';
|
|
16
18
|
import { cva } from 'class-variance-authority';
|
|
17
19
|
|
|
@@ -433,29 +435,20 @@ function idToTitle(id) {
|
|
|
433
435
|
return result.join('');
|
|
434
436
|
}
|
|
435
437
|
|
|
436
|
-
const processor =
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
],
|
|
440
|
-
rehypePlugins: [
|
|
441
|
-
rehypeCode
|
|
442
|
-
],
|
|
443
|
-
outputFormat: 'function-body',
|
|
444
|
-
development: process.env.NODE_ENV === 'development'
|
|
445
|
-
});
|
|
438
|
+
const processor = remark().use(remarkGfm).use(remarkImage, {
|
|
439
|
+
useImport: false
|
|
440
|
+
}).use(remarkRehype).use(rehypeCode);
|
|
446
441
|
async function Markdown({ text }) {
|
|
447
|
-
const
|
|
442
|
+
const nodes = processor.parse({
|
|
448
443
|
value: text
|
|
449
444
|
});
|
|
450
|
-
const
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
const rendered = hydrateFn.apply(hydrateFn, values);
|
|
458
|
-
return /*#__PURE__*/ createElement(rendered.default, {
|
|
445
|
+
const hast = await processor.run(nodes);
|
|
446
|
+
return toJsxRuntime(hast, {
|
|
447
|
+
development: false,
|
|
448
|
+
jsx: jsx,
|
|
449
|
+
jsxs: jsxs,
|
|
450
|
+
Fragment,
|
|
451
|
+
// @ts-expect-error -- safe to use
|
|
459
452
|
components: defaultMdxComponents
|
|
460
453
|
});
|
|
461
454
|
}
|
|
@@ -700,7 +693,7 @@ function Operation({ path, method, ctx, hasHead }) {
|
|
|
700
693
|
if (body) {
|
|
701
694
|
const type = getPreferredType(body.content);
|
|
702
695
|
if (!type) throw new Error(`No supported media type for body content: ${path}`);
|
|
703
|
-
info.push(/*#__PURE__*/ jsxs(Fragment, {
|
|
696
|
+
info.push(/*#__PURE__*/ jsxs(Fragment$1, {
|
|
704
697
|
children: [
|
|
705
698
|
heading(level, 'Request Body', ctx),
|
|
706
699
|
/*#__PURE__*/ jsxs("div", {
|
|
@@ -1001,33 +994,34 @@ const sharedTransformers = [
|
|
|
1001
994
|
}
|
|
1002
995
|
];
|
|
1003
996
|
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
997
|
+
async function CodeBlock({ code, lang, ...options }) {
|
|
998
|
+
const html = await codeToHast(code, {
|
|
999
|
+
lang,
|
|
1000
|
+
defaultColor: false,
|
|
1001
|
+
themes: {
|
|
1002
|
+
light: 'github-light',
|
|
1003
|
+
dark: 'github-dark'
|
|
1004
|
+
},
|
|
1005
|
+
transformers: sharedTransformers
|
|
1006
|
+
});
|
|
1007
|
+
const codeblock = toJsxRuntime(html, {
|
|
1008
|
+
development: false,
|
|
1009
|
+
// @ts-expect-error -- untyped
|
|
1010
|
+
jsx,
|
|
1011
|
+
// @ts-expect-error -- untyped
|
|
1012
|
+
jsxs,
|
|
1013
|
+
components: {
|
|
1014
|
+
// eslint-disable-next-line react/no-unstable-nested-components -- server component
|
|
1015
|
+
pre: (props)=>/*#__PURE__*/ jsx(Base.Pre, {
|
|
1016
|
+
...props,
|
|
1017
|
+
...options
|
|
1018
|
+
})
|
|
1019
|
+
},
|
|
1020
|
+
Fragment: Fragment$1
|
|
1021
|
+
});
|
|
1023
1022
|
return /*#__PURE__*/ jsx(Base.CodeBlock, {
|
|
1024
1023
|
className: "my-0",
|
|
1025
|
-
children:
|
|
1026
|
-
...props,
|
|
1027
|
-
dangerouslySetInnerHTML: {
|
|
1028
|
-
__html: html
|
|
1029
|
-
}
|
|
1030
|
-
})
|
|
1024
|
+
children: codeblock
|
|
1031
1025
|
});
|
|
1032
1026
|
}
|
|
1033
1027
|
|
|
@@ -1053,7 +1047,10 @@ const defaultRenderer = {
|
|
|
1053
1047
|
}),
|
|
1054
1048
|
Property,
|
|
1055
1049
|
ObjectCollapsible,
|
|
1056
|
-
Requests: Tabs,
|
|
1050
|
+
Requests: (props)=>/*#__PURE__*/ jsx(Tabs, {
|
|
1051
|
+
groupId: "fumadocs_openapi_requests",
|
|
1052
|
+
...props
|
|
1053
|
+
}),
|
|
1057
1054
|
Request: (props)=>/*#__PURE__*/ jsx(Tab, {
|
|
1058
1055
|
value: props.name,
|
|
1059
1056
|
children: /*#__PURE__*/ jsx(CodeBlock, {
|
|
@@ -1158,7 +1155,7 @@ function getBadgeColor(method) {
|
|
|
1158
1155
|
}
|
|
1159
1156
|
if (method) {
|
|
1160
1157
|
const color = getBadgeColor(method);
|
|
1161
|
-
node.name = /*#__PURE__*/ jsxs(Fragment
|
|
1158
|
+
node.name = /*#__PURE__*/ jsxs(Fragment, {
|
|
1162
1159
|
children: [
|
|
1163
1160
|
node.name,
|
|
1164
1161
|
' ',
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "fumadocs-openapi",
|
|
3
|
-
"version": "5.4.
|
|
3
|
+
"version": "5.4.6",
|
|
4
4
|
"description": "Generate MDX docs for your OpenAPI spec",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"NextJs",
|
|
@@ -45,31 +45,31 @@
|
|
|
45
45
|
],
|
|
46
46
|
"dependencies": {
|
|
47
47
|
"@apidevtools/json-schema-ref-parser": "^11.7.0",
|
|
48
|
-
"@
|
|
48
|
+
"@fumari/json-schema-to-typescript": "^1.1.0",
|
|
49
49
|
"@radix-ui/react-select": "^2.1.1",
|
|
50
50
|
"@radix-ui/react-slot": "^1.1.0",
|
|
51
|
-
"@types/mdx": "^2.0.13",
|
|
52
51
|
"class-variance-authority": "^0.7.0",
|
|
53
52
|
"fast-glob": "^3.3.1",
|
|
54
53
|
"github-slugger": "^2.0.0",
|
|
54
|
+
"hast-util-to-jsx-runtime": "^2.3.0",
|
|
55
55
|
"js-yaml": "^4.1.0",
|
|
56
|
-
"
|
|
57
|
-
"lucide-react": "^0.428.0",
|
|
56
|
+
"lucide-react": "^0.437.0",
|
|
58
57
|
"openapi-sampler": "^1.5.1",
|
|
59
|
-
"react-hook-form": "^7.
|
|
60
|
-
"remark": "^15.0.
|
|
61
|
-
"
|
|
58
|
+
"react-hook-form": "^7.53.0",
|
|
59
|
+
"remark": "^15.0.1",
|
|
60
|
+
"remark-rehype": "^11.1.0",
|
|
61
|
+
"shiki": "^1.15.2",
|
|
62
62
|
"swr": "^2.2.5",
|
|
63
|
-
"fumadocs-core": "13.4.
|
|
64
|
-
"fumadocs-ui": "13.4.
|
|
63
|
+
"fumadocs-core": "13.4.2",
|
|
64
|
+
"fumadocs-ui": "13.4.2"
|
|
65
65
|
},
|
|
66
66
|
"devDependencies": {
|
|
67
67
|
"@types/js-yaml": "^4.0.9",
|
|
68
|
-
"@types/node": "22.
|
|
68
|
+
"@types/node": "22.5.2",
|
|
69
69
|
"@types/openapi-sampler": "^1.0.3",
|
|
70
|
-
"@types/react": "^18.3.
|
|
71
|
-
"bunchee": "^5.
|
|
72
|
-
"next": "^14.2.
|
|
70
|
+
"@types/react": "^18.3.5",
|
|
71
|
+
"bunchee": "^5.4.0",
|
|
72
|
+
"next": "^14.2.7",
|
|
73
73
|
"openapi-types": "^12.1.3",
|
|
74
74
|
"eslint-config-custom": "0.0.0",
|
|
75
75
|
"tsconfig": "0.0.0"
|