rspress-plugin-api-extractor 0.8.3 → 0.8.4

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.
@@ -115,29 +115,31 @@ function validateOptions(options, rspressConfig) {
115
115
  });
116
116
  return;
117
117
  }
118
- if (api) if (multiVersion) {
119
- if (!api.versions) return yield* new ConfigValidationError({
120
- field: "api.versions",
121
- reason: "'versions' is required when multiVersion is active."
122
- });
123
- const pluginKeys = new Set(Object.keys(api.versions));
124
- const rspressKeys = new Set(multiVersion.versions);
125
- if (pluginKeys.size !== rspressKeys.size || ![...pluginKeys].every((k) => rspressKeys.has(k))) return yield* new ConfigValidationError({
126
- field: "api.versions",
127
- reason: `api.versions keys [${[...pluginKeys].join(", ")}] must exactly match multiVersion.versions [${[...rspressKeys].join(", ")}].`
128
- });
129
- } else {
130
- if (api.versions) yield* emit(PluginEvent.ConfigCascadeWarning({
131
- ctx: { buildId: "" },
132
- level: "warn",
133
- field: "versions",
134
- chosen: "(none — multiVersion not configured)",
135
- ignored: ["api.versions"]
136
- }));
137
- if (!api.model) return yield* new ConfigValidationError({
138
- field: "api.model",
139
- reason: "'model' is required when multiVersion is not active."
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) if (secureUrl.startsWith("https://")) resolvedSecureUrl = secureUrl;
144
- else emitEvent(PluginEvent.ConfigValidationWarning({
145
- ctx: { buildId: currentBuildId },
146
- field: "ogImage.secureUrl",
147
- value: secureUrl,
148
- reason: "secureUrl must be absolute HTTPS",
149
- level: "warn"
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",
3
+ "version": "0.8.4",
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.101",
41
- "@effect/sql-sqlite-node": "4.0.0-beta.101",
42
- "@effected/semver": "^0.3.1",
43
- "@effected/store": "^0.1.3",
44
- "@effected/tsconfig-json": "^0.4.1",
45
- "@effected/xdg": "^0.1.10",
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.2.0",
44
+ "@effected/tsconfig-json": "^0.5.0",
45
+ "@effected/xdg": "^0.2.0",
46
46
  "@microsoft/api-extractor-model": "^7.33.10",
47
- "@shikijs/twoslash": "^4.4.1",
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.101",
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.1",
62
- "type-registry-effect": "^2.3.2",
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
  },
@@ -110,30 +110,32 @@ const remarkWithApi = (options) => {
110
110
  slow: isSlow,
111
111
  level: "debug"
112
112
  }));
113
- if (parent && typeof index === "number") if (isSsgMd) {
114
- const cleanCode = hastToHtml(hast).replace(/<[^>]*>/g, "").replace(/&lt;/g, "<").replace(/&gt;/g, ">").replace(/&amp;/g, "&").replace(/&quot;/g, "\"").replace(/&#39;/g, "'").trim();
115
- node.lang = "typescript";
116
- node.meta = void 0;
117
- node.value = cleanCode;
118
- } else {
119
- const displayCode = stripTwoslashDirectives(code);
120
- const hastJson = JSON.stringify(hast);
121
- const mdxNode = {
122
- type: "mdxJsxFlowElement",
123
- name: "ApiExample",
124
- attributes: [{
125
- type: "mdxJsxAttribute",
126
- name: "code",
127
- value: displayCode
128
- }, {
129
- type: "mdxJsxAttribute",
130
- name: "hast",
131
- value: hastJson
132
- }],
133
- children: []
134
- };
135
- parent.children[index] = mdxNode;
136
- needsApiExampleImport = true;
113
+ if (parent && typeof index === "number") {
114
+ if (isSsgMd) {
115
+ const cleanCode = hastToHtml(hast).replace(/<[^>]*>/g, "").replace(/&lt;/g, "<").replace(/&gt;/g, ">").replace(/&amp;/g, "&").replace(/&quot;/g, "\"").replace(/&#39;/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);
@@ -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) if (typeof config.tsconfig === "function") options = await config.tsconfig();
93
- else {
94
- const tsconfigPath = String(config.tsconfig);
95
- try {
96
- options = parseTsConfig(tsconfigPath, projectRoot);
97
- } catch (error) {
98
- if (error instanceof TsConfigParseError) throw error;
99
- throw new TsConfigParseError(tsconfigPath, error instanceof Error ? error.message : String(error), error);
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);