rspress-plugin-api-extractor 0.8.3 → 0.8.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/layers/ConfigServiceLive.js +25 -23
- package/og-resolver.js +10 -8
- package/package.json +11 -11
- package/remark-with-api.js +26 -24
- package/typescript-config.js +10 -8
|
@@ -115,29 +115,31 @@ function validateOptions(options, rspressConfig) {
|
|
|
115
115
|
});
|
|
116
116
|
return;
|
|
117
117
|
}
|
|
118
|
-
if (api)
|
|
119
|
-
if (
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
118
|
+
if (api) {
|
|
119
|
+
if (multiVersion) {
|
|
120
|
+
if (!api.versions) return yield* new ConfigValidationError({
|
|
121
|
+
field: "api.versions",
|
|
122
|
+
reason: "'versions' is required when multiVersion is active."
|
|
123
|
+
});
|
|
124
|
+
const pluginKeys = new Set(Object.keys(api.versions));
|
|
125
|
+
const rspressKeys = new Set(multiVersion.versions);
|
|
126
|
+
if (pluginKeys.size !== rspressKeys.size || ![...pluginKeys].every((k) => rspressKeys.has(k))) return yield* new ConfigValidationError({
|
|
127
|
+
field: "api.versions",
|
|
128
|
+
reason: `api.versions keys [${[...pluginKeys].join(", ")}] must exactly match multiVersion.versions [${[...rspressKeys].join(", ")}].`
|
|
129
|
+
});
|
|
130
|
+
} else {
|
|
131
|
+
if (api.versions) yield* emit(PluginEvent.ConfigCascadeWarning({
|
|
132
|
+
ctx: { buildId: "" },
|
|
133
|
+
level: "warn",
|
|
134
|
+
field: "versions",
|
|
135
|
+
chosen: "(none — multiVersion not configured)",
|
|
136
|
+
ignored: ["api.versions"]
|
|
137
|
+
}));
|
|
138
|
+
if (!api.model) return yield* new ConfigValidationError({
|
|
139
|
+
field: "api.model",
|
|
140
|
+
reason: "'model' is required when multiVersion is not active."
|
|
141
|
+
});
|
|
142
|
+
}
|
|
141
143
|
}
|
|
142
144
|
});
|
|
143
145
|
}
|
package/og-resolver.js
CHANGED
|
@@ -140,14 +140,16 @@ var OpenGraphResolver = class {
|
|
|
140
140
|
return;
|
|
141
141
|
}
|
|
142
142
|
let resolvedSecureUrl;
|
|
143
|
-
if (secureUrl)
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
143
|
+
if (secureUrl) {
|
|
144
|
+
if (secureUrl.startsWith("https://")) resolvedSecureUrl = secureUrl;
|
|
145
|
+
else emitEvent(PluginEvent.ConfigValidationWarning({
|
|
146
|
+
ctx: { buildId: currentBuildId },
|
|
147
|
+
field: "ogImage.secureUrl",
|
|
148
|
+
value: secureUrl,
|
|
149
|
+
reason: "secureUrl must be absolute HTTPS",
|
|
150
|
+
level: "warn"
|
|
151
|
+
}));
|
|
152
|
+
}
|
|
151
153
|
return {
|
|
152
154
|
url: resolvedUrl,
|
|
153
155
|
secureUrl: resolvedSecureUrl,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "rspress-plugin-api-extractor",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.5",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "RSPress plugin for generating API documentation from TypeScript API Extractor models",
|
|
6
6
|
"keywords": [
|
|
@@ -37,18 +37,18 @@
|
|
|
37
37
|
"./package.json": "./package.json"
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"@effect/platform-node": "4.0.0-beta.
|
|
41
|
-
"@effect/sql-sqlite-node": "4.0.0-beta.
|
|
42
|
-
"@effected/semver": "^0.
|
|
43
|
-
"@effected/store": "^0.
|
|
44
|
-
"@effected/tsconfig-json": "^0.
|
|
45
|
-
"@effected/xdg": "^0.1
|
|
40
|
+
"@effect/platform-node": "4.0.0-beta.107",
|
|
41
|
+
"@effect/sql-sqlite-node": "4.0.0-beta.107",
|
|
42
|
+
"@effected/semver": "^0.4.0",
|
|
43
|
+
"@effected/store": "^0.3.0",
|
|
44
|
+
"@effected/tsconfig-json": "^0.5.0",
|
|
45
|
+
"@effected/xdg": "^0.2.1",
|
|
46
46
|
"@microsoft/api-extractor-model": "^7.33.10",
|
|
47
|
-
"@shikijs/twoslash": "^4.4.
|
|
47
|
+
"@shikijs/twoslash": "^4.4.3",
|
|
48
48
|
"@typescript/vfs": "^1.6.4",
|
|
49
49
|
"api-extractor-llms": "^0.2.0",
|
|
50
50
|
"clsx": "^2.1.1",
|
|
51
|
-
"effect": "4.0.0-beta.
|
|
51
|
+
"effect": "4.0.0-beta.107",
|
|
52
52
|
"gray-matter": "^4.0.3",
|
|
53
53
|
"hast-util-to-jsx-runtime": "^2.3.6",
|
|
54
54
|
"image-size": "^2.0.2",
|
|
@@ -58,8 +58,8 @@
|
|
|
58
58
|
"open": "^11.0.0",
|
|
59
59
|
"prettier": "^3.9.6",
|
|
60
60
|
"react-markdown": "^10.1.0",
|
|
61
|
-
"shiki": "^4.4.
|
|
62
|
-
"type-registry-effect": "^2.3.
|
|
61
|
+
"shiki": "^4.4.3",
|
|
62
|
+
"type-registry-effect": "^2.3.3",
|
|
63
63
|
"typescript": "^6.0.3",
|
|
64
64
|
"unist-util-visit": "^5.1.0"
|
|
65
65
|
},
|
package/remark-with-api.js
CHANGED
|
@@ -110,30 +110,32 @@ const remarkWithApi = (options) => {
|
|
|
110
110
|
slow: isSlow,
|
|
111
111
|
level: "debug"
|
|
112
112
|
}));
|
|
113
|
-
if (parent && typeof index === "number")
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
113
|
+
if (parent && typeof index === "number") {
|
|
114
|
+
if (isSsgMd) {
|
|
115
|
+
const cleanCode = hastToHtml(hast).replace(/<[^>]*>/g, "").replace(/</g, "<").replace(/>/g, ">").replace(/&/g, "&").replace(/"/g, "\"").replace(/'/g, "'").trim();
|
|
116
|
+
node.lang = "typescript";
|
|
117
|
+
node.meta = void 0;
|
|
118
|
+
node.value = cleanCode;
|
|
119
|
+
} else {
|
|
120
|
+
const displayCode = stripTwoslashDirectives(code);
|
|
121
|
+
const hastJson = JSON.stringify(hast);
|
|
122
|
+
const mdxNode = {
|
|
123
|
+
type: "mdxJsxFlowElement",
|
|
124
|
+
name: "ApiExample",
|
|
125
|
+
attributes: [{
|
|
126
|
+
type: "mdxJsxAttribute",
|
|
127
|
+
name: "code",
|
|
128
|
+
value: displayCode
|
|
129
|
+
}, {
|
|
130
|
+
type: "mdxJsxAttribute",
|
|
131
|
+
name: "hast",
|
|
132
|
+
value: hastJson
|
|
133
|
+
}],
|
|
134
|
+
children: []
|
|
135
|
+
};
|
|
136
|
+
parent.children[index] = mdxNode;
|
|
137
|
+
needsApiExampleImport = true;
|
|
138
|
+
}
|
|
137
139
|
}
|
|
138
140
|
})();
|
|
139
141
|
promises.push(promise);
|
package/typescript-config.js
CHANGED
|
@@ -89,14 +89,16 @@ function mergeCompilerOptions(base, override) {
|
|
|
89
89
|
async function resolveTypeScriptConfigSingleAsync(config, projectRoot) {
|
|
90
90
|
if (!config) return {};
|
|
91
91
|
let options = {};
|
|
92
|
-
if (config.tsconfig)
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
92
|
+
if (config.tsconfig) {
|
|
93
|
+
if (typeof config.tsconfig === "function") options = await config.tsconfig();
|
|
94
|
+
else {
|
|
95
|
+
const tsconfigPath = String(config.tsconfig);
|
|
96
|
+
try {
|
|
97
|
+
options = parseTsConfig(tsconfigPath, projectRoot);
|
|
98
|
+
} catch (error) {
|
|
99
|
+
if (error instanceof TsConfigParseError) throw error;
|
|
100
|
+
throw new TsConfigParseError(tsconfigPath, error instanceof Error ? error.message : String(error), error);
|
|
101
|
+
}
|
|
100
102
|
}
|
|
101
103
|
}
|
|
102
104
|
if (config.compilerOptions) options = mergeCompilerOptions(options, config.compilerOptions);
|