Skip to content

feat(web): introduce stability overview#644

Open
AugustinMauroy wants to merge 5 commits intomainfrom
augu-stability-overview-web
Open

feat(web): introduce stability overview#644
AugustinMauroy wants to merge 5 commits intomainfrom
augu-stability-overview-web

Conversation

@AugustinMauroy
Copy link
Member

@AugustinMauroy AugustinMauroy commented Mar 5, 2026

Description

introduce stability overview on new web generator

Validation

It's should be cool 😎

Related Issues

Close #357

Check List

  • I have read the Contributing Guidelines and made commit messages that follow the guideline.
  • I have run node --run test and all tests passed.
  • I have check code formatting with node --run format & node --run lint.
  • I've covered new added functionality with unit tests if necessary.

Copilot AI review requested due to automatic review settings March 5, 2026 09:15
@AugustinMauroy AugustinMauroy requested a review from a team as a code owner March 5, 2026 09:15
@vercel
Copy link

vercel bot commented Mar 5, 2026

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

Project Deployment Actions Updated (UTC)
api-docs-tooling Ready Ready Preview Mar 5, 2026 9:44pm

Request Review

@codecov
Copy link

codecov bot commented Mar 5, 2026

Codecov Report

❌ Patch coverage is 75.40984% with 45 lines in your changes missing coverage. Please review.
✅ Project coverage is 75.93%. Comparing base (acb4c34) to head (83203ee).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
src/generators/jsx-ast/generate.mjs 0.00% 24 Missing ⚠️
src/generators/jsx-ast/utils/buildContent.mjs 12.50% 21 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #644      +/-   ##
==========================================
+ Coverage   75.90%   75.93%   +0.02%     
==========================================
  Files         145      147       +2     
  Lines       13735    13910     +175     
  Branches      992     1001       +9     
==========================================
+ Hits        10426    10562     +136     
- Misses       3303     3342      +39     
  Partials        6        6              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@github-actions
Copy link

github-actions bot commented Mar 5, 2026

web Generator

File Base Head Diff
documentation.html 36.92 KB 50.38 KB +13.46 KB (+36.44%)
documentation.js 9.74 KB 21.57 KB +11.83 KB (+121.41%)
styles.css 137.01 KB 141.80 KB +4.79 KB (+3.50%)
index.js 9.69 KB 9.70 KB +15.00 B (+0.15%)
embedding.js 37.29 KB 37.30 KB +5.00 B (+0.01%)
intl.js 37.08 KB 37.08 KB +5.00 B (+0.01%)
synopsis.js 15.72 KB 15.72 KB +5.00 B (+0.03%)

@AugustinMauroy AugustinMauroy marked this pull request as draft March 5, 2026 09:22
Copy link
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

Introduces a “Stability Overview” table to the new web generator output, mirroring the legacy generator’s ability to render a stability summary on the “About”/documentation page when slot tags are present.

Changes:

  • Add StabilityOverview UI component (CSS + JSX) and register it in web JSX import mapping.
  • Precompute and pass stability overview entries through the jsx-ast generator pipeline, injecting the table when the slot tag is present.
  • Ensure the web generator creates the output directory before writing HTML/JS/CSS artifacts.

Reviewed changes

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

Show a summary per file
File Description
src/generators/web/ui/components/StabilityOverview/index.module.css Adds minimal layout styling for the stability overview table and badge cell.
src/generators/web/ui/components/StabilityOverview/index.jsx Implements the stability overview table UI using Badge tooltips.
src/generators/web/generate.mjs Creates config.output directory before emitting generated files.
src/generators/web/constants.mjs Registers StabilityOverview in JSX_IMPORTS for bundling/import generation.
src/generators/jsx-ast/utils/buildContent.mjs Threads stability overview entries through processEntry and injects the component when slot tags are present.
src/generators/jsx-ast/generate.mjs Precomputes stability overview data once and passes it to workers via the extra stream context.

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

@AugustinMauroy AugustinMauroy marked this pull request as ready for review March 5, 2026 21:44
Copy link
Member

@avivkeller avivkeller left a comment

Choose a reason for hiding this comment

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

I wonder if adding stability to the sidebar would be better?

@AugustinMauroy
Copy link
Member Author

AugustinMauroy commented Mar 7, 2026

I wonder if adding stability to the sidebar would be better?

It's should be on toc ? it's already

@ovflowd
Copy link
Member

ovflowd commented Mar 8, 2026

I wonder if adding stability to the sidebar would be better?

It's should be on toc ? it's already

I wonder if Aviv meant completely being there or maybe always being there? Although that seems a discussion for another issue.


const STABILITY_KINDS = ['error', 'warning', 'default', 'info'];

/**
Copy link
Member

Choose a reason for hiding this comment

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

nit: remove this empty doc

Copy link
Member Author

Choose a reason for hiding this comment

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

if we remove it es-lint ask for it but it's doesn't require any jsdoc

Copy link
Member

Choose a reason for hiding this comment

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

Just remove it or do proper JSdoc for it.

.filter(node => node.stability?.children?.length)
.map(({ api, heading, stability }) => {
const [{ data }] = stability.children;
return {
Copy link
Member

Choose a reason for hiding this comment

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

Could this map fn be moved to a dedicated function and be unit tested? Thanks!

Copy link
Member Author

Choose a reason for hiding this comment

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

seem reasonable


// Pre-compute stability overview data once — avoid serialising full AST nodes to workers
const stabilityOverviewEntries = headNodes
.filter(node => node.stability?.children?.length)
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
.filter(node => node.stability?.children?.length)
.filter(node => !!node.stability?.children?.length)

Copy link
Member Author

Choose a reason for hiding this comment

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

oh 🤓 that's smart

);

// Inject the stability overview table where the slot tag is present
if (
Copy link
Member

@ovflowd ovflowd Mar 8, 2026

Choose a reason for hiding this comment

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

I wonder how optimal this is... I wonder if a visit statement is better here, I also kinda dislike this method of inserting the stability index.

Copy link
Member

@ovflowd ovflowd left a comment

Choose a reason for hiding this comment

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

This method would make sense for legacy docs. For the new docs, this method isn't really acceptable. The stability overview must be a React component now for the web generator, and all that we must do here is replace the STABILITY_OVERVIEW_SLOT_BEGIN or IDK with a slot for the component.

This would also make it easier to maintain the component.

@AugustinMauroy
Copy link
Member Author

This method would make sense for legacy docs. For the new docs, this method isn't really acceptable. The stability overview must be a React component now for the web generator, and all that we must do here is replace the STABILITY_OVERVIEW_SLOT_BEGIN or IDK with a slot for the component.

This would also make it easier to maintain the component.

i do that but aviv ask for AST approach #644 (comment)

So what should I do ?

@avivkeller
Copy link
Member

I asked for an AST approach for generating a table, however, if that's not possible for a sidebar, we don't have to do it.

I meant, the badge that you have in the table might be better suited in the sidebar, WDYT?

@ovflowd
Copy link
Member

ovflowd commented Mar 8, 2026

I asked for an AST approach for generating a table, however, if that's not possible for a sidebar, we don't have to do it.

I meant, the badge that you have in the table might be better suited in the sidebar, WDYT?

I understand why an AST approach, but I'd prefer a React component here, we're using AST trees for building the structure of the page, which is fine I guess? But I'd rather have it being a React tree, not gonna lie. For example a lot of things are done in places that don't make much sense for me, for example https://github.com/nodejs/doc-kit/blob/main/src/generators/jsx-ast/utils/buildContent.mjs#L289-L316, we're building the document tree in JSX here by using this ast.mjs file (https://github.com/nodejs/doc-kit/blob/main/src/generators/jsx-ast/utils/ast.mjs) and this is awkward as hell for me and hard to maintain. If we ever want to make change to the document tree or customizing props, this is going to be incredibly hard for newcomers.

I was never fan of this approach but initially it was simple, now it is overly complex. We're hand-crafting JSX elements here, where the reality is we could just make regular React Components (JSX Components/Elements)..

The other part that hinders customization of doc-kit is that we already wire straight on the jsx-ast generator our own ui-components which limit in the future if people want to have other layouts/designs or use their own components for the structure of their docs.

This is more of a long-term ask, but I do feel we should try to make the customization and maintainability here as easy as possible, but the jsx-ast seems to be doing too much stuff and too much hard-coded (https://github.com/nodejs/doc-kit/tree/main/src/generators/jsx-ast)...

It'd be great if the Stability Overview is its own component. Could be on node-core/ui-components or specifically in the components folder on the web generator.

@avivkeller
Copy link
Member

avivkeller commented Mar 8, 2026

Building the AST directly results in both faster, smaller, and more memory efficient builds.

It's a little off putting for new comers, I suppose, however, thats nothing some documentation can't fix.

I disagree that everything should be a client-side JSX element, I think that JSX elements should only be used when an AST implementation is not feasible.

@avivkeller
Copy link
Member

The other part that hinders customization of doc-kit is that we already wire straight on the jsx-ast generator our own ui-components which limit in the future if people want to have other layouts/designs or use their own components for the structure of their docs.

That's something that can definitely be changed. For instance, we allow customization of the logo, we can allow customization of everything else.

@avivkeller
Copy link
Member

@ovflowd if you have an issue with the current approach, feel free to open a designated issue and voice your concerns, which others can agree or refute

@ovflowd
Copy link
Member

ovflowd commented Mar 8, 2026

I disagree that everything should be a JSX element, I think that JSX elements should only be used when an AST implementation is not feasible.

You are literally creating JSX elements manually on jsx-ast...

@ovflowd
Copy link
Member

ovflowd commented Mar 8, 2026

It's a little off putting for new comers, I suppose, however, thats nothing some documentation can't fix.

How you see customization of the tree or document or components with the current hard-coded jsx tree?

@ovflowd
Copy link
Member

ovflowd commented Mar 8, 2026

Btw, I still believe this should be a React component. I'm 👎 with the current approach because I know we can make it simpler with React, but if that's too much trouble, I can waive my block.

@AugustinMauroy
Copy link
Member Author

@avivkeller agree that I should comme back to react component ?

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.

Generating the Stability Overview

4 participants