Skip to content

chore: improve output with metadata processing#91

Merged
avivkeller merged 6 commits into
mainfrom
metadata-processing
May 25, 2026
Merged

chore: improve output with metadata processing#91
avivkeller merged 6 commits into
mainfrom
metadata-processing

Conversation

@avivkeller
Copy link
Copy Markdown
Member

@avivkeller avivkeller commented May 24, 2026

This PR improves the doc-kit generation pipeline by:

  1. Pulling in comments that are missing from types.d.ts by reading source files directly
  2. Adding additional inline documentation and code comments for clarity
  3. Categorizing data as discussed on Discord
  4. Updating declaration outputs to better adhere to https://raw.githubusercontent.com/nodejs/doc-kit/refs/heads/main/docs/specification.md.

cc @webpack/gsoc-2026: I’d appreciate reviews and feedback on any mistakes, edge cases, or changes that should be made.

Additionally, this PR refactors the processor into several smaller modules:

  1. Sitemap generation
  2. Routing
  3. Type map generation
  4. export= consolidation
  5. Source comment appending (required to recover all source-level comments)

At the moment, sitemap categories are defined using regular expressions, though this can be adjusted later if needed.

source.mjs can eventually be removed once either:

  • types.d.ts includes all source comments, or
  • the Webpack source is migrated to a TypeScript-compatible structure (e.g. converted to TypeScript or updated for TS 7.0 support).

Copilot AI review requested due to automatic review settings May 24, 2026 02:55
@vercel
Copy link
Copy Markdown

vercel Bot commented May 24, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
webpack-doc-kit Ready Ready Preview, Comment May 25, 2026 6:41pm

Request Review

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the TypeDoc → Markdown → doc-kit pipeline to generate docs that better align with the doc-kit specification by enriching reflections with source-file JSDoc metadata, reorganizing routing/output structure (including synthetic “types” pages), and adjusting theme partials/helpers to emit doc-kit-shaped Markdown.

Changes:

  • Introduces a processor-layer router and metadata pass to enrich reflections from webpack/lib source comments and to reorganize output pages/anchors (including category “types” pages).
  • Refactors theme partials/helpers to keep titles/anchors in sync with the router and to format examples/signatures in a doc-kit-friendly way.
  • Tweaks generation configuration (plugin entrypoints, TypeDoc options, doc-kit config inputs and web settings).

Reviewed changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
scripts/markdown.mjs Switches to the new processor plugin entrypoint and adjusts TypeDoc output options.
plugins/theme/router.mjs Removes the theme-owned router (routing moved into the processor plugin).
plugins/theme/partials/index.mjs Major partial overrides for doc-kit-style headings/lists and type-page-aware titles.
plugins/theme/index.mjs Stops registering a router from the theme plugin (theme-only registration remains).
plugins/theme/helpers/index.mjs Updates example rendering to fence bare snippets and align with doc-kit expectations.
plugins/shared/titles.mjs Centralizes title/signature formatting to keep router + theme anchors consistent.
plugins/shared/categories.mjs Adds category inference rules used by routing/type-page generation.
plugins/processor/router.mjs Adds a processor-owned router with synthetic type pages and doc-kit slugging/anchors.
plugins/processor/metadata.mjs Adds source-metadata extraction from webpack/lib JS files and applies it to reflections.
plugins/processor/index.mjs Wires router registration, metadata enrichment, and writes the final type-map using router URLs.
doc-kit.config.mjs Adjusts doc-kit input globbing and web generation settings (threads/remote config).
Comments suppressed due to low confidence (1)

plugins/processor/index.mjs:18

  • typeMapKey() duplicates the same “prefix project root name if missing” logic that also exists in plugins/shared/titles.mjs (fullName()). Duplicating this logic risks drift between rendered titles/anchors and the generated type-map keys; consider importing and reusing the shared helper instead of reimplementing it here.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread plugins/shared/categories.mjs
Comment thread plugins/shared/categories.mjs
Comment thread plugins/processor/router.mjs Outdated
Comment thread plugins/processor/metadata.mjs Outdated
Copilot AI review requested due to automatic review settings May 24, 2026 12:17
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review is ineligible. To be eligible to request a review, you need a paid Copilot license, or your organization must enable Copilot code review.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review is ineligible. To be eligible to request a review, you need a paid Copilot license, or your organization must enable Copilot code review.

@avivkeller
Copy link
Copy Markdown
Member Author

@moshams272 Thanks for pushing those commits! Unfortunately, I ended up overwriting them during my push because I had already incorporated the same ideas in a slightly different way.

For example, the READMEindex workaround was replaced by configuring TypeDoc to emit the entry file as index directly instead of readme, which avoids the need for the additional workaround layer.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 18 out of 19 changed files in this pull request and generated 3 comments.

Comment thread plugins/processor/router.mjs
Comment thread plugins/processor/typeMap.mjs
Comment thread plugins/shared/titles.mjs
Comment thread plugins/processor/site.mjs
Comment thread plugins/processor/router.mjs Outdated
Comment thread scripts/markdown.mjs
Copilot AI review requested due to automatic review settings May 25, 2026 18:37
@avivkeller avivkeller requested a review from ryzrr May 25, 2026 18:38
@avivkeller avivkeller requested a review from moshams272 May 25, 2026 18:38
@avivkeller
Copy link
Copy Markdown
Member Author

@ryzrr @moshams272 Unless you have more comments, could you approve this so it can land? We can iterate in follow-ups, but I feel like I (and this is my fault) am making this PR very large

This reverts commit 4b9b3d2.
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 18 out of 19 changed files in this pull request and generated 3 comments.

{
category: 'assets',
label: 'Assets',
pattern: /^Asset|AssetInfo$/,
{
category: 'externals',
label: 'Externals',
pattern: /^External|Externals/,
headingLevel: options.headingLevel,
showTags: false,
}),
ctx.helpers.examples(comment, options),
@moshams272
Copy link
Copy Markdown

@ryzrr @moshams272 Unless you have more comments, could you approve this so it can land? We can iterate in follow-ups, but I feel like I (and this is my fault) am making this PR very large

I really enjoyed reviewing this code. Don't worry about the PR size at all, it's totally worth it.

@avivkeller avivkeller merged commit 6522abf into main May 25, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants