@rspress/plugin-typedoc 1.40.2 → 1.41.0
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/es/index.mjs +9 -9
- package/dist/lib/index.js +10 -10
- package/package.json +7 -7
- package/src/patch.ts +1 -1
package/dist/es/index.mjs
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import * as __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__ from "node:path";
|
|
2
2
|
import * as __WEBPACK_EXTERNAL_MODULE_typedoc__ from "typedoc";
|
|
3
3
|
import * as __WEBPACK_EXTERNAL_MODULE_typedoc_plugin_markdown_836f15e3__ from "typedoc-plugin-markdown";
|
|
4
|
-
import * as
|
|
4
|
+
import * as __WEBPACK_EXTERNAL_MODULE_node_fs_promises_153e37e0__ from "node:fs/promises";
|
|
5
5
|
const API_DIR = 'api';
|
|
6
6
|
async function patchLinks(outputDir) {
|
|
7
7
|
const normalizeLinksInFile = async (filePath)=>{
|
|
8
|
-
const content = await
|
|
8
|
+
const content = await __WEBPACK_EXTERNAL_MODULE_node_fs_promises_153e37e0__["default"].readFile(filePath, 'utf-8');
|
|
9
9
|
const newContent = content.replace(/\[([^\]]+)\]\(([^)]+)\)/g, (_match, p1, p2)=>{
|
|
10
10
|
if ([
|
|
11
11
|
'/',
|
|
@@ -13,12 +13,12 @@ async function patchLinks(outputDir) {
|
|
|
13
13
|
].includes(p2[0])) return `[${p1}](${p2})`;
|
|
14
14
|
return `[${p1}](./${p2})`;
|
|
15
15
|
});
|
|
16
|
-
await
|
|
16
|
+
await __WEBPACK_EXTERNAL_MODULE_node_fs_promises_153e37e0__["default"].writeFile(filePath, newContent);
|
|
17
17
|
};
|
|
18
18
|
const traverse = async (dir)=>{
|
|
19
|
-
const files = await
|
|
19
|
+
const files = await __WEBPACK_EXTERNAL_MODULE_node_fs_promises_153e37e0__["default"].readdir(dir);
|
|
20
20
|
const filePaths = files.map((file)=>__WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].join(dir, file));
|
|
21
|
-
const stats = await Promise.all(filePaths.map((fp)=>
|
|
21
|
+
const stats = await Promise.all(filePaths.map((fp)=>__WEBPACK_EXTERNAL_MODULE_node_fs_promises_153e37e0__["default"].stat(fp)));
|
|
22
22
|
await Promise.all(stats.map((stat, index)=>{
|
|
23
23
|
const file = files[index];
|
|
24
24
|
const filePath = filePaths[index];
|
|
@@ -30,23 +30,23 @@ async function patchLinks(outputDir) {
|
|
|
30
30
|
}
|
|
31
31
|
async function generateMetaJson(absoluteApiDir) {
|
|
32
32
|
const metaJsonPath = __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].join(absoluteApiDir, '_meta.json');
|
|
33
|
-
const files = await
|
|
33
|
+
const files = await __WEBPACK_EXTERNAL_MODULE_node_fs_promises_153e37e0__["default"].readdir(absoluteApiDir);
|
|
34
34
|
const filePaths = files.map((file)=>__WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].join(absoluteApiDir, file));
|
|
35
|
-
const stats = await Promise.all(filePaths.map((fp)=>
|
|
35
|
+
const stats = await Promise.all(filePaths.map((fp)=>__WEBPACK_EXTERNAL_MODULE_node_fs_promises_153e37e0__["default"].stat(fp)));
|
|
36
36
|
const dirs = stats.map((stat, index)=>stat.isDirectory() ? files[index] : null).filter(Boolean);
|
|
37
37
|
const meta = dirs.map((dir)=>({
|
|
38
38
|
type: 'dir',
|
|
39
39
|
label: dir.slice(0, 1).toUpperCase() + dir.slice(1),
|
|
40
40
|
name: dir
|
|
41
41
|
}));
|
|
42
|
-
await
|
|
42
|
+
await __WEBPACK_EXTERNAL_MODULE_node_fs_promises_153e37e0__["default"].writeFile(metaJsonPath, JSON.stringify([
|
|
43
43
|
'index',
|
|
44
44
|
...meta
|
|
45
45
|
]));
|
|
46
46
|
}
|
|
47
47
|
async function patchGeneratedApiDocs(absoluteApiDir) {
|
|
48
48
|
await patchLinks(absoluteApiDir);
|
|
49
|
-
await
|
|
49
|
+
await __WEBPACK_EXTERNAL_MODULE_node_fs_promises_153e37e0__["default"].rename(__WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].join(absoluteApiDir, 'README.md'), __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].join(absoluteApiDir, 'index.md'));
|
|
50
50
|
await generateMetaJson(absoluteApiDir);
|
|
51
51
|
}
|
|
52
52
|
function pluginTypeDoc(options) {
|
package/dist/lib/index.js
CHANGED
|
@@ -46,11 +46,11 @@ var external_node_path_default = /*#__PURE__*/ __webpack_require__.n(external_no
|
|
|
46
46
|
const external_typedoc_namespaceObject = require("typedoc");
|
|
47
47
|
const external_typedoc_plugin_markdown_namespaceObject = require("typedoc-plugin-markdown");
|
|
48
48
|
const API_DIR = 'api';
|
|
49
|
-
const
|
|
50
|
-
var
|
|
49
|
+
const promises_namespaceObject = require("node:fs/promises");
|
|
50
|
+
var promises_default = /*#__PURE__*/ __webpack_require__.n(promises_namespaceObject);
|
|
51
51
|
async function patchLinks(outputDir) {
|
|
52
52
|
const normalizeLinksInFile = async (filePath)=>{
|
|
53
|
-
const content = await
|
|
53
|
+
const content = await promises_default().readFile(filePath, 'utf-8');
|
|
54
54
|
const newContent = content.replace(/\[([^\]]+)\]\(([^)]+)\)/g, (_match, p1, p2)=>{
|
|
55
55
|
if ([
|
|
56
56
|
'/',
|
|
@@ -58,12 +58,12 @@ async function patchLinks(outputDir) {
|
|
|
58
58
|
].includes(p2[0])) return `[${p1}](${p2})`;
|
|
59
59
|
return `[${p1}](./${p2})`;
|
|
60
60
|
});
|
|
61
|
-
await
|
|
61
|
+
await promises_default().writeFile(filePath, newContent);
|
|
62
62
|
};
|
|
63
63
|
const traverse = async (dir)=>{
|
|
64
|
-
const files = await
|
|
64
|
+
const files = await promises_default().readdir(dir);
|
|
65
65
|
const filePaths = files.map((file)=>external_node_path_default().join(dir, file));
|
|
66
|
-
const stats = await Promise.all(filePaths.map((fp)=>
|
|
66
|
+
const stats = await Promise.all(filePaths.map((fp)=>promises_default().stat(fp)));
|
|
67
67
|
await Promise.all(stats.map((stat, index)=>{
|
|
68
68
|
const file = files[index];
|
|
69
69
|
const filePath = filePaths[index];
|
|
@@ -75,23 +75,23 @@ async function patchLinks(outputDir) {
|
|
|
75
75
|
}
|
|
76
76
|
async function generateMetaJson(absoluteApiDir) {
|
|
77
77
|
const metaJsonPath = external_node_path_default().join(absoluteApiDir, '_meta.json');
|
|
78
|
-
const files = await
|
|
78
|
+
const files = await promises_default().readdir(absoluteApiDir);
|
|
79
79
|
const filePaths = files.map((file)=>external_node_path_default().join(absoluteApiDir, file));
|
|
80
|
-
const stats = await Promise.all(filePaths.map((fp)=>
|
|
80
|
+
const stats = await Promise.all(filePaths.map((fp)=>promises_default().stat(fp)));
|
|
81
81
|
const dirs = stats.map((stat, index)=>stat.isDirectory() ? files[index] : null).filter(Boolean);
|
|
82
82
|
const meta = dirs.map((dir)=>({
|
|
83
83
|
type: 'dir',
|
|
84
84
|
label: dir.slice(0, 1).toUpperCase() + dir.slice(1),
|
|
85
85
|
name: dir
|
|
86
86
|
}));
|
|
87
|
-
await
|
|
87
|
+
await promises_default().writeFile(metaJsonPath, JSON.stringify([
|
|
88
88
|
'index',
|
|
89
89
|
...meta
|
|
90
90
|
]));
|
|
91
91
|
}
|
|
92
92
|
async function patchGeneratedApiDocs(absoluteApiDir) {
|
|
93
93
|
await patchLinks(absoluteApiDir);
|
|
94
|
-
await
|
|
94
|
+
await promises_default().rename(external_node_path_default().join(absoluteApiDir, 'README.md'), external_node_path_default().join(absoluteApiDir, 'index.md'));
|
|
95
95
|
await generateMetaJson(absoluteApiDir);
|
|
96
96
|
}
|
|
97
97
|
function pluginTypeDoc(options) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rspress/plugin-typedoc",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.41.0",
|
|
4
4
|
"description": "A plugin for rspress to integrate typedoc",
|
|
5
5
|
"bugs": "https://github.com/web-infra-dev/rspress/issues",
|
|
6
6
|
"repository": {
|
|
@@ -25,21 +25,21 @@
|
|
|
25
25
|
"dependencies": {
|
|
26
26
|
"typedoc": "0.24.8",
|
|
27
27
|
"typedoc-plugin-markdown": "3.17.1",
|
|
28
|
-
"@rspress/shared": "1.
|
|
28
|
+
"@rspress/shared": "1.41.0"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
|
-
"@microsoft/api-extractor": "^7.49.
|
|
32
|
-
"@modern-js/tsconfig": "2.
|
|
33
|
-
"@rslib/core": "0.
|
|
31
|
+
"@microsoft/api-extractor": "^7.49.2",
|
|
32
|
+
"@modern-js/tsconfig": "2.64.0",
|
|
33
|
+
"@rslib/core": "0.4.0",
|
|
34
34
|
"@types/node": "^18.11.17",
|
|
35
35
|
"@types/react": "^18.3.18",
|
|
36
36
|
"@types/react-dom": "^18.3.5",
|
|
37
37
|
"react": "^18.3.1",
|
|
38
38
|
"typescript": "^5.5.3",
|
|
39
|
-
"vitest": "2.1.
|
|
39
|
+
"vitest": "2.1.9"
|
|
40
40
|
},
|
|
41
41
|
"peerDependencies": {
|
|
42
|
-
"rspress": "^1.
|
|
42
|
+
"rspress": "^1.41.0"
|
|
43
43
|
},
|
|
44
44
|
"engines": {
|
|
45
45
|
"node": ">=14.17.6"
|