Skip to content

Conversation

@avivkeller
Copy link
Member

@avivkeller avivkeller commented Dec 22, 2025

  • Stability nodes are no longer assumed to be the first element under a heading, and are instead found via .findIndex
  • property detection now properly assigns .type without changing the property type to misc (via the addition of a new __promote property)
  • Our RegEx now identifies functions without a preceding module name (i.e. init() will now be matched alongside my_module.init())
  • Method names with symbols (i.e. myMethod[Symbol()](props)) are now corrected
  • Fixes The content of the third-level table has been truncated. #527
  • napi versions are correctly treated as numbers, and not string[]

Copilot AI review requested due to automatic review settings December 22, 2025 18:13
@avivkeller avivkeller requested a review from a team as a code owner December 22, 2025 18:13
@vercel
Copy link

vercel bot commented Dec 22, 2025

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

Project Deployment Review Updated (UTC)
api-docs-tooling Ready Ready Preview Dec 23, 2025 4:34pm

@codecov
Copy link

codecov bot commented Dec 22, 2025

Codecov Report

❌ Patch coverage is 85.92593% with 19 lines in your changes missing coverage. Please review.
✅ Project coverage is 79.89%. Comparing base (776dd0b) to head (809c5ad).
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
src/generators/legacy-json/utils/buildSection.mjs 6.66% 14 Missing ⚠️
src/generators/jsx-ast/utils/buildContent.mjs 0.00% 1 Missing ⚠️
...rc/generators/jsx-ast/utils/buildPropertyTable.mjs 50.00% 1 Missing ⚠️
src/generators/jsx-ast/utils/buildSignature.mjs 0.00% 1 Missing ⚠️
src/generators/legacy-json/utils/parseList.mjs 93.75% 1 Missing ⚠️
src/utils/queries/index.mjs 95.23% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #526      +/-   ##
==========================================
+ Coverage   79.82%   79.89%   +0.06%     
==========================================
  Files         121      122       +1     
  Lines       12017    12070      +53     
  Branches      840      843       +3     
==========================================
+ Hits         9593     9643      +50     
- Misses       2421     2424       +3     
  Partials        3        3              

☔ 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.

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

This PR improves the legacy JSON generator to produce output that more closely matches the expected format. The changes address discrepancies found in the first 7 files alphabetically during testing.

Key changes:

  • Enhanced regex pattern to match methods without a module name prefix (e.g., init() alongside module.init())
  • Refactored property type assignment to preserve both the parsed type and the original property classification using a __promote marker
  • Improved stability node detection to use findIndex instead of assuming the first position

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
src/utils/parser/constants.mjs Updated method regex to match functions with or without module/property prefixes
src/generators/legacy-json/utils/parseList.mjs Changed property handling to use Object.assign with __promote marker to preserve type information
src/generators/legacy-json/utils/buildSection.mjs Refactored stability parsing to use findIndex and updated addToParent to respect __promote marker

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

@avivkeller avivkeller marked this pull request as draft December 22, 2025 18:28
@avivkeller
Copy link
Member Author

avivkeller commented Dec 22, 2025

[Draft while I finish looking for differences. Currently at: tracing]

Possible TODOs for a follow-up:

  • legacy-json does not generate Stability Index (neither does web, fwiw)

section.stability = Number(stabilityNode.data.index);
section.stabilityText = stabilityNode.data.description;

const nodeToRemove = content.children.findIndex(
Copy link
Member

Choose a reason for hiding this comment

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

This feels like an expensive search, we should have the node index.

Copy link
Member Author

Choose a reason for hiding this comment

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

We don't have it stored anywhere

Object.assign(section, values[0]);

// TODO(@avivkeller): There is probably a better way to do this.
section.__promote = 'property';
Copy link
Member

Choose a reason for hiding this comment

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

What is this?

Copy link
Member Author

Choose a reason for hiding this comment

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

When we Object.assign(section, values[0]);, we replace section.type with values[0].type (the type of the property, i.e. string, etc)

When promoting properties to their parent (moving the section into misc, properties, modules, whatever), we check the .type, if property, we move to properties. However, since the type has been overwritten, we still need to move the object to the correct parent section, properties

Copy link
Member

Choose a reason for hiding this comment

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

I'm unfamiliar with the __promote property, where does that come from?

Copy link
Member Author

@avivkeller avivkeller Dec 22, 2025

Choose a reason for hiding this comment

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

My brain xD, I just added it for this purpose. It's deleted during promotion

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.

SGTM! Although tests are failing!

@avivkeller
Copy link
Member Author

Although tests are failing!

Yes, I'm aware. I'm going to fix them once I go through each file and confirm the diff (it's a slow process...)

@avivkeller avivkeller linked an issue Dec 23, 2025 that may be closed by this pull request
@avivkeller
Copy link
Member Author

(Once complete, this PR will resolve that issue, since this is a regression from the old tooling to our tooling)

@ovflowd
Copy link
Member

ovflowd commented Dec 23, 2025

Unrelated-ish, due to how human eyes work, when looking at these (on the page) the method signature width feels smaller than the stability index one, and that's simply due to the fact that stability index component doesn't has a border with a different colour. Could we have all our stability indexes banners to also have a border in their respective accent colour?

image

@ovflowd
Copy link
Member

ovflowd commented Dec 23, 2025

Unrelated-ish, due to how human eyes work, when looking at these (on the page) the method signature width feels smaller than the stability index one, and that's simply due to the fact that stability index component doesn't has a border with a different colour. Could we have all our stability indexes banners to also have a border in their respective accent colour?

image

Another possible fix is simply having the border accent of the method banner to be a stronger accent colour.

@avivkeller avivkeller marked this pull request as ready for review December 23, 2025 16:10
@avivkeller avivkeller force-pushed the more-identical-legacy-json branch from 1ad05ee to 842c8f6 Compare December 23, 2025 16:10
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

Copilot reviewed 12 out of 12 changed files in this pull request and generated 7 comments.


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

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.

The content of the third-level table has been truncated.

3 participants