rspress-plugin-api-extractor 0.18.3 → 0.18.5
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "rspress-plugin-api-extractor",
|
|
3
|
-
"version": "0.18.
|
|
3
|
+
"version": "0.18.5",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "RSPress plugin for generating API documentation from TypeScript API Extractor models",
|
|
6
6
|
"keywords": [
|
|
@@ -37,34 +37,34 @@
|
|
|
37
37
|
"./package.json": "./package.json"
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"@effect/platform-node": "4.0.0-rc.
|
|
41
|
-
"@effected/github": "^0.
|
|
42
|
-
"@effected/glob": "^0.
|
|
43
|
-
"@effected/jsonc": "^0.
|
|
44
|
-
"@effected/markdown": "^0.
|
|
45
|
-
"@effected/npm": "^0.
|
|
46
|
-
"@effected/package-json": "^0.
|
|
47
|
-
"@effected/schema-org": "^0.
|
|
48
|
-
"@effected/semver": "^0.
|
|
49
|
-
"@effected/spdx": "^0.
|
|
50
|
-
"@effected/store": "^0.
|
|
51
|
-
"@effected/tsconfig-json": "^0.
|
|
52
|
-
"@effected/walker": "^0.
|
|
53
|
-
"@effected/xdg": "^0.
|
|
54
|
-
"@effected/yaml": "^0.
|
|
40
|
+
"@effect/platform-node": "4.0.0-rc.118",
|
|
41
|
+
"@effected/github": "^0.14.0",
|
|
42
|
+
"@effected/glob": "^0.9.0",
|
|
43
|
+
"@effected/jsonc": "^0.14.0",
|
|
44
|
+
"@effected/markdown": "^0.14.0",
|
|
45
|
+
"@effected/npm": "^0.19.0",
|
|
46
|
+
"@effected/package-json": "^0.19.0",
|
|
47
|
+
"@effected/schema-org": "^0.6.0",
|
|
48
|
+
"@effected/semver": "^0.10.0",
|
|
49
|
+
"@effected/spdx": "^0.10.0",
|
|
50
|
+
"@effected/store": "^0.11.0",
|
|
51
|
+
"@effected/tsconfig-json": "^0.12.0",
|
|
52
|
+
"@effected/walker": "^0.13.0",
|
|
53
|
+
"@effected/xdg": "^0.8.0",
|
|
54
|
+
"@effected/yaml": "^0.18.0",
|
|
55
55
|
"@microsoft/api-extractor-model": "7.33.12",
|
|
56
56
|
"@shikijs/twoslash": "^4.4.3",
|
|
57
|
-
"@tsdoctor/bundle": "0.5.
|
|
58
|
-
"@tsdoctor/manifest": "0.2.
|
|
59
|
-
"@tsdoctor/model": "0.8.
|
|
60
|
-
"@tsdoctor/pages": "0.3.
|
|
61
|
-
"@tsdoctor/registry": "0.5.
|
|
62
|
-
"@tsdoctor/seo": "0.4.
|
|
63
|
-
"@tsdoctor/snapshot": "0.4.
|
|
64
|
-
"@tsdoctor/vfs": "0.4.
|
|
57
|
+
"@tsdoctor/bundle": "0.5.2",
|
|
58
|
+
"@tsdoctor/manifest": "0.2.3",
|
|
59
|
+
"@tsdoctor/model": "0.8.4",
|
|
60
|
+
"@tsdoctor/pages": "0.3.5",
|
|
61
|
+
"@tsdoctor/registry": "0.5.2",
|
|
62
|
+
"@tsdoctor/seo": "0.4.3",
|
|
63
|
+
"@tsdoctor/snapshot": "0.4.1",
|
|
64
|
+
"@tsdoctor/vfs": "0.4.1",
|
|
65
65
|
"@typescript/vfs": "^1.6.5",
|
|
66
66
|
"clsx": "^2.1.1",
|
|
67
|
-
"effect": "4.0.0-rc.
|
|
67
|
+
"effect": "4.0.0-rc.118",
|
|
68
68
|
"hast-util-to-jsx-runtime": "^2.3.6",
|
|
69
69
|
"image-size": "^2.0.4",
|
|
70
70
|
"mdast-util-to-hast": "^13.2.1",
|
package/remark-with-api.js
CHANGED
|
@@ -6,7 +6,7 @@ import { setTwoslashFile } from "./twoslash-access.js";
|
|
|
6
6
|
import { createTwoslashTimingWrapper } from "./twoslash-timing-wrapper.js";
|
|
7
7
|
import { formatCode } from "./prettier-formatter.js";
|
|
8
8
|
import { stripTwoslashDirectives } from "@tsdoctor/pages";
|
|
9
|
-
import { codeToHast
|
|
9
|
+
import { codeToHast } from "shiki";
|
|
10
10
|
import { visit } from "unist-util-visit";
|
|
11
11
|
|
|
12
12
|
//#region src/remark-with-api.ts
|
|
@@ -108,14 +108,14 @@ const remarkWithApi = (options) => {
|
|
|
108
108
|
slow: isSlow,
|
|
109
109
|
level: "debug"
|
|
110
110
|
}));
|
|
111
|
+
const displayCode = stripTwoslashDirectives(code);
|
|
111
112
|
if (parent && typeof index === "number") {
|
|
112
113
|
if (isSsgMd) {
|
|
113
|
-
const cleanCode =
|
|
114
|
+
const cleanCode = displayCode.trim();
|
|
114
115
|
node.lang = "typescript";
|
|
115
116
|
node.meta = void 0;
|
|
116
117
|
node.value = cleanCode;
|
|
117
118
|
} else {
|
|
118
|
-
const displayCode = stripTwoslashDirectives(code);
|
|
119
119
|
const hastJson = JSON.stringify(hast);
|
|
120
120
|
const mdxNode = {
|
|
121
121
|
type: "mdxJsxFlowElement",
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { MarkdownContent } from "../MarkdownContent/index.js";
|
|
2
|
+
import { stripTags } from "../../utils/strip-tags.js";
|
|
2
3
|
import index_module_default from "./index.module.js";
|
|
3
4
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
4
5
|
|
|
@@ -17,7 +18,7 @@ const EnumMembersTable = ({ members }) => {
|
|
|
17
18
|
for (const member of members) {
|
|
18
19
|
const name = `\`${member.name}\``;
|
|
19
20
|
const value = member.value ? `\`${member.value}\`` : "";
|
|
20
|
-
const description = member.description
|
|
21
|
+
const description = stripTags(member.description).trim();
|
|
21
22
|
markdown += `| ${name} | ${value} | ${description} |\n`;
|
|
22
23
|
}
|
|
23
24
|
return /* @__PURE__ */ jsx(Fragment, { children: markdown });
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { MarkdownContent } from "../MarkdownContent/index.js";
|
|
2
|
+
import { stripTags } from "../../utils/strip-tags.js";
|
|
2
3
|
import index_module_default from "./index.module.js";
|
|
3
4
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
4
5
|
|
|
@@ -17,7 +18,7 @@ const ParametersTable = ({ parameters }) => {
|
|
|
17
18
|
for (const param of parameters) {
|
|
18
19
|
const name = `\`${param.name}\``;
|
|
19
20
|
const type = param.type ? `\`${param.type}\`` : "";
|
|
20
|
-
const description = param.description
|
|
21
|
+
const description = stripTags(param.description).trim();
|
|
21
22
|
markdown += `| ${name} | ${type} | ${description} |\n`;
|
|
22
23
|
}
|
|
23
24
|
return /* @__PURE__ */ jsx(Fragment, { children: markdown });
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
//#region src/runtime/utils/strip-tags.ts
|
|
2
|
+
/**
|
|
3
|
+
* Remove every `<...>` tag from `text`, keeping the text between tags.
|
|
4
|
+
*
|
|
5
|
+
* A linear scan with the same result as `text.replace(/<[^>]*>/g, "")`: each
|
|
6
|
+
* `<` that has a later `>` is dropped through that `>`, and a `<` with no `>`
|
|
7
|
+
* after it is kept along with the rest of the string. The regex form
|
|
8
|
+
* backtracks quadratically on a long run of unclosed `<`.
|
|
9
|
+
*
|
|
10
|
+
* This is text cleanup for markdown output, not HTML sanitization; the result
|
|
11
|
+
* is rendered as a React text child, which escapes it.
|
|
12
|
+
*/
|
|
13
|
+
function stripTags(text) {
|
|
14
|
+
let out = "";
|
|
15
|
+
let i = 0;
|
|
16
|
+
while (i < text.length) {
|
|
17
|
+
const open = text.indexOf("<", i);
|
|
18
|
+
if (open === -1) return out + text.slice(i);
|
|
19
|
+
const close = text.indexOf(">", open + 1);
|
|
20
|
+
if (close === -1) return out + text.slice(i);
|
|
21
|
+
out += text.slice(i, open);
|
|
22
|
+
i = close + 1;
|
|
23
|
+
}
|
|
24
|
+
return out;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
//#endregion
|
|
28
|
+
export { stripTags };
|