Skip to content

Commit ed5694c

Browse files
committed
fix: docuemntation build breaks
1 parent 3a0ce41 commit ed5694c

3 files changed

Lines changed: 30 additions & 4 deletions

File tree

build/api-docs-generator.js

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -205,8 +205,34 @@ async function generateMarkdown(file, relativePath) {
205205

206206
const modifiedContent = modifyJs(content, fileName);
207207

208-
// Generate markdown using jsdoc-to-markdown as a library
209-
const markdownContent = await jsdoc2md.render({ source: modifiedContent });
208+
// Generate markdown using jsdoc-to-markdown as a library. jsdoc-api spawns
209+
// a child `jsdoc` process per call; under our BATCH_SIZE parallelism the
210+
// child occasionally produces truncated/empty stdout (manifesting as
211+
// "Unexpected end of JSON input"/"Unterminated string in JSON"). Retry
212+
// serially so a single transient failure doesn't abort the whole batch.
213+
let markdownContent;
214+
let lastErr;
215+
for (let attempt = 0; attempt < 3; attempt++) {
216+
try {
217+
markdownContent = await jsdoc2md.render({ source: modifiedContent });
218+
lastErr = undefined;
219+
break;
220+
} catch (err) {
221+
lastErr = err;
222+
const causeMsg = err && err.cause && err.cause.message
223+
? err.cause.message
224+
: '';
225+
const transient = /Unexpected end of JSON input|Unterminated string in JSON|Jsdoc failed/.test(
226+
(err && err.message) || ''
227+
) || /JSON/.test(causeMsg);
228+
if (!transient) break;
229+
await new Promise(r => setTimeout(r, 200 * (attempt + 1)));
230+
}
231+
}
232+
if (lastErr) {
233+
lastErr.message = `[${file}] ${lastErr.message}`;
234+
throw lastErr;
235+
}
210236
const newContent = normalizeLineEndings(
211237
modifyMarkdown(markdownContent, path.join(relativePath, fileName))
212238
);

docs/API-Reference/view/WorkspaceManager.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ The panel's size & visibility are automatically saved & restored as a view-state
111111
| $panel | <code>jQueryObject</code> | DOM content to use as the panel. Need not be in the document yet. Must have an id attribute, for use as a preferences key. |
112112
| [minSize] | <code>number</code> | @deprecated No longer used. Pass `undefined`. |
113113
| [title] | <code>string</code> | Display title shown in the bottom panel tab bar. |
114-
| [options] | <code>Object</code> | Optional settings: - {string} iconSvg Path to an SVG icon for the panel tab (e.g. "styles/images/icon.svg"). If omitted, a generic default icon is used. |
114+
| [options] | <code>Object</code> | Optional settings: - `iconSvg` (string): Path to an SVG icon for the panel tab (e.g. "styles/images/icon.svg"). If omitted, a generic default icon is used. |
115115

116116
<a name="module_view/WorkspaceManager..destroyBottomPanel"></a>
117117

src/view/WorkspaceManager.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,7 @@ define(function (require, exports, module) {
295295
* @param {number=} minSize @deprecated No longer used. Pass `undefined`.
296296
* @param {string=} title Display title shown in the bottom panel tab bar.
297297
* @param {Object=} options Optional settings:
298-
* - {string} iconSvg Path to an SVG icon for the panel tab (e.g. "styles/images/icon.svg").
298+
* - `iconSvg` (string): Path to an SVG icon for the panel tab (e.g. "styles/images/icon.svg").
299299
* If omitted, a generic default icon is used.
300300
* @return {!Panel}
301301
*/

0 commit comments

Comments
 (0)