@alauda/doom 0.2.2 → 0.2.3
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/lib/cli/load-config.js
CHANGED
|
@@ -58,7 +58,7 @@ export async function scanSideMeta(workDir, rootDir, docsDir, routePrefix, exten
|
|
|
58
58
|
});
|
|
59
59
|
sideMeta = (await Promise.all(subItems.map(async (item) => {
|
|
60
60
|
// Fix https://github.com/web-infra-dev/rspress/issues/346
|
|
61
|
-
if (item === '_meta.json') {
|
|
61
|
+
if (item === '_meta.json' || item === 'assets') {
|
|
62
62
|
return null;
|
|
63
63
|
}
|
|
64
64
|
const stat = await fs.stat(path.join(workDir, item));
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
2
|
import { usePageData } from '@rspress/core/runtime';
|
|
3
|
-
import { getCustomMDXComponent } from '@rspress/core/theme';
|
|
3
|
+
import { Badge, getCustomMDXComponent } from '@rspress/core/theme';
|
|
4
4
|
import BananaSlug from 'github-slugger';
|
|
5
5
|
import { OpenAPIV3 } from 'openapi-types';
|
|
6
6
|
import { useMemo } from 'react';
|
|
@@ -24,7 +24,7 @@ export const OpenAPIParameters = ({ parameters, openapi, }) => {
|
|
|
24
24
|
else if (type) {
|
|
25
25
|
typeNode = _jsx(RefLink, { "$ref": type.$ref });
|
|
26
26
|
}
|
|
27
|
-
return (_jsxs(X.li, { children: [_jsx(X.code, { children: paramObj.name }), "(", _jsxs("em", { children: ["in ", paramObj.in] }), "):", ' ', typeNode,
|
|
27
|
+
return (_jsxs(X.li, { children: [_jsx(X.code, { children: paramObj.name }), "(", _jsxs("em", { children: ["in ", paramObj.in] }), "):", ' ', typeNode, paramObj.required && _jsx(Badge, { children: "required" }), _jsx(Markdown, { children: paramObj.description })] }, index));
|
|
28
28
|
}) }));
|
|
29
29
|
};
|
|
30
30
|
export const OpenAPIResponses = ({ responses, openapi, }) => {
|
|
@@ -105,9 +105,14 @@ export const OpenAPIPath = ({ path, openapiPath: openapiPath_, pathPrefix: pathP
|
|
|
105
105
|
return null;
|
|
106
106
|
}
|
|
107
107
|
const { description, parameters, requestBody, responses, summary } = pathItem[method];
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
108
|
+
const requestBodyRef = requestBody &&
|
|
109
|
+
('$ref' in requestBody
|
|
110
|
+
? requestBody.$ref
|
|
111
|
+
: requestBody.content['application/json'].schema?.$ref);
|
|
112
|
+
const requestBodySchema = requestBodyRef
|
|
113
|
+
? resolveRef(openapi, requestBodyRef)
|
|
114
|
+
: undefined;
|
|
115
|
+
return (_jsxs(_Fragment, { children: [_jsxs(HeadingTitle, { slugger: slugger, level: 3, children: [_jsx(X.code, { children: method }), summary] }), _jsx(Markdown, { children: description }), parameters && (_jsxs(_Fragment, { children: [_jsx(HeadingTitle, { slugger: slugger, level: 4, children: "Parameters" }), _jsx(OpenAPIParameters, { parameters: parameters, openapi: openapi })] })), requestBodySchema && (_jsxs(_Fragment, { children: [_jsx(HeadingTitle, { slugger: slugger, level: 4, children: "Request Body" }), _jsxs(X.p, { children: [_jsx(RefLink, { "$ref": requestBodyRef }), requestBodySchema.required && _jsx(Badge, { children: "required" })] })] })), responses && (_jsxs(_Fragment, { children: [_jsx(HeadingTitle, { slugger: slugger, level: 4, children: "Response" }), _jsx(OpenAPIResponses, { responses: responses, openapi: openapi })] }))] }));
|
|
111
116
|
}), refs?.map((ref, index) => {
|
|
112
117
|
return (_jsx(OpenAPIRef, { schema: ref, openapiPath: openapiPath, collectRefs: false }, index));
|
|
113
118
|
})] }));
|
|
@@ -18,7 +18,7 @@ export function Overview(props) {
|
|
|
18
18
|
if ('link' in traverseItem && traverseItem.link) {
|
|
19
19
|
return traverseItem.link;
|
|
20
20
|
}
|
|
21
|
-
if ('items' in traverseItem) {
|
|
21
|
+
if ('items' in traverseItem && traverseItem.items.length) {
|
|
22
22
|
return getChildLink(traverseItem.items[0]);
|
|
23
23
|
}
|
|
24
24
|
return '';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@alauda/doom",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.3",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Doctor Doom making docs.",
|
|
6
6
|
"repository": {
|
|
@@ -28,6 +28,7 @@
|
|
|
28
28
|
"clean": "tsc -b src --clean",
|
|
29
29
|
"dev": "yarn swc-node --watch-path src/cli --watch-path src/plugins src/cli/index.ts",
|
|
30
30
|
"doom": "yarn swc-node src/cli/index.ts",
|
|
31
|
+
"fixture": "yarn doom fixture-docs",
|
|
31
32
|
"lint": "run-p 'lint:*'",
|
|
32
33
|
"lint:es": "eslint .",
|
|
33
34
|
"lint:tsc": "tsc -b --noEmit",
|