Skip to content

feat(jsx): add jsx generator #273

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
May 28, 2025
Merged

feat(jsx): add jsx generator #273

merged 3 commits into from
May 28, 2025

Conversation

avivkeller
Copy link
Member

@avivkeller avivkeller commented May 17, 2025

This PR introduces a jsx generator that transforms Markdown AST and metadata entries into a JSX (recma) AST (with a root of Program), which can then be compiled by the react-web generator from #7.

The JSX generator produces AST that assumes that all the components in #10 (comment) have been implemented.

As of 5/26/25, the generated AST is: https://aviv.sh/hostables/nodejs/1748274862-jsx-ast.json

Copy link
Member

@AugustinMauroy AugustinMauroy left a comment

Choose a reason for hiding this comment

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

Interesting basic, don't miss to add some test

@avivkeller
Copy link
Member Author

I'm working on skipping the MDX and going to straight to JSX, so I'll add lots of tests when that's started

@avivkeller avivkeller changed the title [WIP] mdx generator [WIP] jsx generator May 18, 2025
@avivkeller avivkeller force-pushed the wip/mdx-generator branch 2 times, most recently from 60922b4 to d2bd5f4 Compare May 18, 2025 23:42
@avivkeller
Copy link
Member Author

avivkeller commented May 19, 2025

This uses pnpm for now, see #236 for reference. If we do adopt pnpm, it would be a seperate PR, this is just for development.

@avivkeller avivkeller linked an issue May 20, 2025 that may be closed by this pull request
@avivkeller avivkeller changed the title [WIP] jsx generator feat(jsx): add jsx generator May 21, 2025
@avivkeller avivkeller marked this pull request as ready for review May 22, 2025 00:24
@avivkeller avivkeller force-pushed the wip/mdx-generator branch from 8020c31 to 60e76e5 Compare May 22, 2025 00:24
@avivkeller avivkeller requested a review from a team as a code owner May 22, 2025 00:24
@avivkeller avivkeller force-pushed the wip/mdx-generator branch from ef09a04 to a002cc3 Compare May 22, 2025 21:14
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.

I've left a final round of comments; After that LGTM. But only approving the PR once the git-deps issue is addressed (either by the upstream npm publish or incorporating git-deps on @.pkgjs/@.nodejs)

@avivkeller avivkeller requested a review from anonrig May 26, 2025 17:46
@AugustinMauroy
Copy link
Member

maybe add little bit more test

@avivkeller avivkeller dismissed anonrig’s stale review May 27, 2025 13:06

This review was specific to a security concern, which has since been resolved.

@avivkeller avivkeller requested review from ovflowd and canerakdas May 27, 2025 13:08
@avivkeller avivkeller force-pushed the wip/mdx-generator branch from 26b46c4 to e109999 Compare May 27, 2025 21:36
@codecov-commenter
Copy link

codecov-commenter commented May 27, 2025

Codecov Report

Attention: Patch coverage is 81.35048% with 116 lines in your changes missing coverage. Please review.

Project coverage is 90.55%. Comparing base (37c3202) to head (8d1496c).

✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
src/generators/jsx-ast/utils/buildContent.mjs 59.09% 81 Missing ⚠️
src/utils/remark.mjs 50.00% 13 Missing ⚠️
src/generators/jsx-ast/utils/transformer.mjs 57.69% 11 Missing ⚠️
src/utils/generators.mjs 75.75% 8 Missing ⚠️
src/generators/jsx-ast/utils/buildBarProps.mjs 96.22% 2 Missing ⚠️
src/generators/jsx-ast/utils/ast.mjs 98.73% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #273      +/-   ##
==========================================
- Coverage   91.88%   90.55%   -1.34%     
==========================================
  Files          56       63       +7     
  Lines        4142     4754     +612     
  Branches      174      191      +17     
==========================================
+ Hits         3806     4305     +499     
- Misses        334      446     +112     
- Partials        2        3       +1     

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

@avivkeller avivkeller force-pushed the wip/mdx-generator branch 2 times, most recently from 22a9dc7 to 3e302a1 Compare May 27, 2025 21:39
@avivkeller avivkeller force-pushed the wip/mdx-generator branch from 3e302a1 to b89fe19 Compare May 28, 2025 16:48
@avivkeller avivkeller requested a review from AugustinMauroy May 28, 2025 16:51
@avivkeller avivkeller merged commit e543fba into main May 28, 2025
8 checks passed
@avivkeller avivkeller deleted the wip/mdx-generator branch May 28, 2025 16:56
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.

Add mdx-react generator
8 participants