Skip to content

Commit f0abf2c

Browse files
committed
fix(typedoc): link re-exports in module lists to what they export
A re-export linked to an anchor its module's page doesn't have, and functions were listed without a summary, as their comment is their signature's. Assisted-by: Claude Opus 5.5 <noreply@anthropic.com>
1 parent 0867451 commit f0abf2c

2 files changed

Lines changed: 7 additions & 3 deletions

File tree

‎packages/typedoc/src/__tests__/index.test.mjs.snapshot‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ exports[`the doc-kit output > renders every file 1`] = `
1616
"interfaces/ServerEvents.md": "# Interface: ServerEvents\\n\\n<!-- YAML\\ntitle: \\"Interface: ServerEvents\\"\\nsource_link: index.ts#L144\\n-->\\n\\nThe events of a [Server](Server.md), with the arguments of their listeners.\\n\\n<div id=\\"connect\\"></div>\\n\\n## \`serverEvents.connect\`\\n\\n<!-- YAML\\nsource_link: index.ts#L146\\n-->\\n\\n- Type: {[id: string]}\\n\\nA client connected.\\n",
1717
"interfaces/WatchOptions.md": "# Interface: WatchOptions\\n\\n<!-- YAML\\ntitle: \\"Interface: WatchOptions\\"\\nsource_link: index.ts#L36\\n-->\\n\\n- Extends: {BuildOptions}\\n\\nOptions of a watched build. Changes wait for [WatchOptions.delay](#watchoptionsdelay),\\nthen rebuild as [BuildOptions.input](BuildOptions.input.md) says.\\n\\n## Properties\\n\\n- \`input\` {string} The entry module. [Details](BuildOptions.input.md)\\n- \`minify\` {boolean} Whether to minify the output. [Details](BuildOptions.minify.md)\\n- \`output\` {Object} Where to write the output. [Details](BuildOptions.output.md)\\n\\n<div id=\\"delay\\"></div>\\n\\n## \`watchOptions.delay\`\\n\\n<!-- YAML\\nsource_link: index.ts#L38\\n-->\\n\\n- Type: {number}\\n\\nMilliseconds to wait for further changes.\\n",
1818
"interfaces/WatcherEvents.md": "# Interface: WatcherEvents\\n\\n<!-- YAML\\ntitle: \\"Interface: WatcherEvents\\"\\nsource_link: index.ts#L44\\n-->\\n\\nThe events of a [Watcher](../classes/Watcher.md), with the arguments of their listeners.\\n\\n<div id=\\"done\\"></div>\\n\\n## \`watcherEvents.done\`\\n\\n<!-- YAML\\nsource_link: index.ts#L46\\n-->\\n\\n- Type: {[duration: number]}\\n\\nA build finished.\\n\\n<div id=\\"error\\"></div>\\n\\n## \`watcherEvents.error\`\\n\\n<!-- YAML\\nsource_link: index.ts#L48\\n-->\\n\\n- Type: {[error: Error, details: { file: string }]}\\n\\nA build failed.\\n",
19-
"modules/fixture_utils.md": "# Module: fixture/utils\\n\\n<!-- YAML\\ntitle: \\"Module: fixture/utils\\"\\nsource_link: utils.ts#L1\\n-->\\n\\nUtilities for plugins.\\n\\n## Functions\\n\\n- [\`hash\`](../functions/fixture_utils.hash.md)\\n\\n## References\\n\\n- [\`build\`](#build)\\n",
19+
"modules/fixture_utils.md": "# Module: fixture/utils\\n\\n<!-- YAML\\ntitle: \\"Module: fixture/utils\\"\\nsource_link: utils.ts#L1\\n-->\\n\\nUtilities for plugins.\\n\\n## Functions\\n\\n- [\`hash\`](../functions/fixture_utils.hash.md) Hashes a module's code.\\n\\n## References\\n\\n- [\`build\`](../functions/build.md) Builds once.\\n",
2020
"modules/plugins.md": "# Namespace: plugins\\n\\n<!-- YAML\\ntitle: \\"Namespace: plugins\\"\\nsource_link: index.ts#L177\\n-->\\n\\nPlugins shipped with the bundler.\\n\\n## Classes\\n\\n- [\`BannerPlugin\`](../classes/plugins.BannerPlugin.md) Prepends a banner to every chunk.\\n",
2121
"pages.json": "[\\n {\\n \\"name\\": \\"fixture/utils\\",\\n \\"kind\\": \\"Module\\",\\n \\"url\\": \\"/api/modules/fixture_utils\\"\\n },\\n {\\n \\"name\\": \\"fixture/utils.hash\\",\\n \\"kind\\": \\"Function\\",\\n \\"url\\": \\"/api/functions/fixture_utils.hash\\"\\n },\\n {\\n \\"name\\": \\"plugins\\",\\n \\"kind\\": \\"Namespace\\",\\n \\"url\\": \\"/api/modules/plugins\\"\\n },\\n {\\n \\"name\\": \\"plugins.BannerPlugin\\",\\n \\"kind\\": \\"Class\\",\\n \\"url\\": \\"/api/classes/plugins.BannerPlugin\\"\\n },\\n {\\n \\"name\\": \\"Level\\",\\n \\"kind\\": \\"Enum\\",\\n \\"url\\": \\"/api/enums/Level\\"\\n },\\n {\\n \\"name\\": \\"Watcher\\",\\n \\"kind\\": \\"Class\\",\\n \\"url\\": \\"/api/classes/Watcher\\"\\n },\\n {\\n \\"name\\": \\"BuildOptions\\",\\n \\"kind\\": \\"Interface\\",\\n \\"url\\": \\"/api/interfaces/BuildOptions\\"\\n },\\n {\\n \\"name\\": \\"BuildOptions.input\\",\\n \\"kind\\": \\"Property\\",\\n \\"url\\": \\"/api/interfaces/BuildOptions.input\\"\\n },\\n {\\n \\"name\\": \\"BuildOptions.minify\\",\\n \\"kind\\": \\"Property\\",\\n \\"url\\": \\"/api/interfaces/BuildOptions.minify\\"\\n },\\n {\\n \\"name\\": \\"BuildOptions.output\\",\\n \\"kind\\": \\"Property\\",\\n \\"url\\": \\"/api/interfaces/BuildOptions.output\\"\\n },\\n {\\n \\"name\\": \\"Compile\\",\\n \\"kind\\": \\"Interface\\",\\n \\"url\\": \\"/api/interfaces/Compile\\"\\n },\\n {\\n \\"name\\": \\"Server\\",\\n \\"kind\\": \\"Interface\\",\\n \\"url\\": \\"/api/interfaces/Server\\"\\n },\\n {\\n \\"name\\": \\"ServerEvents\\",\\n \\"kind\\": \\"Interface\\",\\n \\"url\\": \\"/api/interfaces/ServerEvents\\"\\n },\\n {\\n \\"name\\": \\"WatcherEvents\\",\\n \\"kind\\": \\"Interface\\",\\n \\"url\\": \\"/api/interfaces/WatcherEvents\\"\\n },\\n {\\n \\"name\\": \\"WatchOptions\\",\\n \\"kind\\": \\"Interface\\",\\n \\"url\\": \\"/api/interfaces/WatchOptions\\"\\n },\\n {\\n \\"name\\": \\"Format\\",\\n \\"kind\\": \\"TypeAlias\\",\\n \\"url\\": \\"/api/types/Format\\"\\n },\\n {\\n \\"name\\": \\"Transform\\",\\n \\"kind\\": \\"TypeAlias\\",\\n \\"url\\": \\"/api/types/Transform\\"\\n },\\n {\\n \\"name\\": \\"compile\\",\\n \\"kind\\": \\"Variable\\",\\n \\"url\\": \\"/api/variables/compile\\"\\n },\\n {\\n \\"name\\": \\"identity\\",\\n \\"kind\\": \\"Variable\\",\\n \\"url\\": \\"/api/variables/identity\\"\\n },\\n {\\n \\"name\\": \\"VERSION\\",\\n \\"kind\\": \\"Variable\\",\\n \\"url\\": \\"/api/variables/VERSION\\"\\n },\\n {\\n \\"name\\": \\"build\\",\\n \\"kind\\": \\"Function\\",\\n \\"url\\": \\"/api/functions/build\\"\\n },\\n {\\n \\"name\\": \\"print\\",\\n \\"kind\\": \\"Function\\",\\n \\"url\\": \\"/api/functions/print\\"\\n },\\n {\\n \\"name\\": \\"watch\\",\\n \\"kind\\": \\"Function\\",\\n \\"url\\": \\"/api/functions/watch\\"\\n }\\n]",
2222
"type-map.json": "{\\n \\"BannerPlugin\\": \\"api/classes/plugins.BannerPlugin\\",\\n \\"Level\\": \\"api/enums/Level\\",\\n \\"Watcher\\": \\"api/classes/Watcher\\",\\n \\"BuildOptions\\": \\"api/interfaces/BuildOptions\\",\\n \\"Compile\\": \\"api/interfaces/Compile\\",\\n \\"Server\\": \\"api/interfaces/Server\\",\\n \\"ServerEvents\\": \\"api/interfaces/ServerEvents\\",\\n \\"WatcherEvents\\": \\"api/interfaces/WatcherEvents\\",\\n \\"WatchOptions\\": \\"api/interfaces/WatchOptions\\",\\n \\"Format\\": \\"api/types/Format\\",\\n \\"Transform\\": \\"api/types/Transform\\"\\n}",

‎packages/typedoc/src/render/pages.mjs‎

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ import {
1414
import { renderType } from './types.mjs';
1515
import { code, firstSentence, heading } from '../utils/markdown.mjs';
1616
import {
17+
commentOf,
18+
deref,
1719
isCallable,
1820
objectDeclaration,
1921
signaturesOf,
@@ -86,8 +88,10 @@ const containerPage = (context, container) => {
8688
lines.push(heading(2, title), '');
8789

8890
for (const child of children) {
89-
const [summary] = splitSummary(context, child.comment);
90-
const link = `[${code(child.name)}](${context.router.linkTo(context.page, child)})`;
91+
// A re-export links to what it exports
92+
const target = deref(child);
93+
const [summary] = splitSummary(context, commentOf(target));
94+
const link = `[${code(child.name)}](${context.router.linkTo(context.page, target)})`;
9195

9296
lines.push(`- ${link} ${firstSentence(summary)}`.trim());
9397
}

0 commit comments

Comments
 (0)