@rspress/plugin-api-docgen 1.43.0-canary-20240224 → 1.43.0-canary-202503021351
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/index.js +23 -3
- package/index.d.ts +7 -0
- package/package.json +6 -6
- package/static/global-components/API.tsx +4 -2
package/dist/index.js
CHANGED
@@ -99,9 +99,25 @@ var __webpack_exports__ = {};
|
|
99
99
|
type: 'Type',
|
100
100
|
defaultValue: 'Default Value',
|
101
101
|
overview: 'Overview'
|
102
|
+
},
|
103
|
+
ru: {
|
104
|
+
copy: 'Копировать',
|
105
|
+
copied: 'Скопировано успешно',
|
106
|
+
expand: 'Развернуть код',
|
107
|
+
collapse: 'Свернуть код',
|
108
|
+
className: 'Имя класса узла',
|
109
|
+
style: 'Стиль узла',
|
110
|
+
children: 'Дочерние элементы',
|
111
|
+
disabled: 'Отключено',
|
112
|
+
required: 'Обязательно',
|
113
|
+
property: 'Свойство',
|
114
|
+
description: 'Описание',
|
115
|
+
type: 'Тип',
|
116
|
+
defaultValue: 'Значение по умолчанию',
|
117
|
+
overview: 'Обзор'
|
102
118
|
}
|
103
119
|
};
|
104
|
-
const isToolEntries = (obj)
|
120
|
+
const isToolEntries = (obj)=>!!obj.documentation || !!obj["react-docgen-typescript"];
|
105
121
|
const docgen = async ({ entries, languages, apiParseTool, appDir, parseToolOptions, isProd })=>{
|
106
122
|
const watchFileMap = {};
|
107
123
|
const genApiDoc = async (entry, tool)=>{
|
@@ -257,8 +273,12 @@ var __webpack_exports__ = {};
|
|
257
273
|
async beforeBuild (config, isProd) {
|
258
274
|
var _config_themeConfig_locales, _config_themeConfig, _config_locales;
|
259
275
|
const languages = ((null === (_config_themeConfig = config.themeConfig) || void 0 === _config_themeConfig ? void 0 : null === (_config_themeConfig_locales = _config_themeConfig.locales) || void 0 === _config_themeConfig_locales ? void 0 : _config_themeConfig_locales.map((locale)=>locale.lang)) || (null === (_config_locales = config.locales) || void 0 === _config_locales ? void 0 : _config_locales.map((locale)=>locale.lang)) || [
|
260
|
-
config.lang
|
261
|
-
]).filter((lang)=>
|
276
|
+
config.lang || 'en'
|
277
|
+
]).filter((lang)=>[
|
278
|
+
'zh',
|
279
|
+
'en',
|
280
|
+
'ru'
|
281
|
+
].includes(lang));
|
262
282
|
await docgen({
|
263
283
|
entries,
|
264
284
|
apiParseTool,
|
package/index.d.ts
ADDED
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@rspress/plugin-api-docgen",
|
3
|
-
"version": "1.43.0-canary-
|
3
|
+
"version": "1.43.0-canary-202503021351",
|
4
4
|
"description": "A plugin for rspress to generate api doc.",
|
5
5
|
"bugs": "https://github.com/web-infra-dev/rspress/issues",
|
6
6
|
"repository": {
|
@@ -10,10 +10,11 @@
|
|
10
10
|
},
|
11
11
|
"license": "MIT",
|
12
12
|
"main": "./dist/index.js",
|
13
|
-
"types": "./
|
13
|
+
"types": "./index.d.ts",
|
14
14
|
"files": [
|
15
15
|
"dist",
|
16
16
|
"static",
|
17
|
+
"index.d.ts",
|
17
18
|
"mdx-meta-loader.cjs"
|
18
19
|
],
|
19
20
|
"dependencies": {
|
@@ -22,11 +23,11 @@
|
|
22
23
|
"react-docgen-typescript": "2.2.2",
|
23
24
|
"react-markdown": "8.0.7",
|
24
25
|
"remark-gfm": "3.0.1",
|
25
|
-
"@rspress/shared": "1.43.0-canary-
|
26
|
+
"@rspress/shared": "1.43.0-canary-202503021351"
|
26
27
|
},
|
27
28
|
"devDependencies": {
|
28
29
|
"@microsoft/api-extractor": "^7.49.2",
|
29
|
-
"@rslib/core": "0.
|
30
|
+
"@rslib/core": "0.5.2",
|
30
31
|
"@types/mdast": "^3.0.15",
|
31
32
|
"@types/node": "^18.11.17",
|
32
33
|
"@types/react": "^18.3.18",
|
@@ -39,7 +40,7 @@
|
|
39
40
|
"unist-util-visit": "^4.1.2"
|
40
41
|
},
|
41
42
|
"peerDependencies": {
|
42
|
-
"@rspress/core": "^1.42.
|
43
|
+
"@rspress/core": "^1.42.1",
|
43
44
|
"react": ">=17.0.0",
|
44
45
|
"react-router-dom": "^6.8.1",
|
45
46
|
"typescript": "^5.5.3"
|
@@ -57,7 +58,6 @@
|
|
57
58
|
"provenance": true,
|
58
59
|
"registry": "https://registry.npmjs.org/"
|
59
60
|
},
|
60
|
-
"jsnext:source": "./src/index.ts",
|
61
61
|
"scripts": {
|
62
62
|
"build": "rslib build",
|
63
63
|
"dev": "rslib build -w",
|
@@ -1,3 +1,5 @@
|
|
1
|
+
/// <reference path="../../index.d.ts" />
|
2
|
+
|
1
3
|
import { useLang, usePageData } from '@rspress/core/runtime';
|
2
4
|
import { getCustomMDXComponent } from '@rspress/core/theme';
|
3
5
|
import ReactMarkdown from 'react-markdown';
|
@@ -9,10 +11,10 @@ export default (props: { moduleName: string }) => {
|
|
9
11
|
const { page } = usePageData();
|
10
12
|
const { moduleName } = props;
|
11
13
|
// some api doc have two languages.
|
12
|
-
const apiDocMap = page.apiDocMap
|
14
|
+
const apiDocMap = page.apiDocMap;
|
13
15
|
// avoid error when no page data
|
14
16
|
const apiDoc =
|
15
|
-
apiDocMap?.[moduleName] || apiDocMap?.[`${moduleName}-${lang}`];
|
17
|
+
apiDocMap?.[moduleName] || apiDocMap?.[`${moduleName}-${lang}`] || '';
|
16
18
|
return (
|
17
19
|
<ReactMarkdown
|
18
20
|
remarkPlugins={[[remarkGfm]]}
|