Skip to content

perf: let jsx-ast and html start on their dependency's first chunk - #1241

Open
ovflowd wants to merge 1 commit into
perf/stream-metadatafrom
perf/stream-html
Open

ovflowd wants to merge 1 commit into
perf/stream-metadatafrom
perf/stream-html

Conversation

@ovflowd

@ovflowd ovflowd commented Nov 3, 2026 •

Copy link
Copy Markdown
Member

Description

This PR lets jsx-ast and html start on their dependency's first chunk, so with more than one thread page building and rendering overlap with the generators before them. It's the fifth part of a stack that splits #1205, and the biggest: jsx-ast's new output is what html reads, so they go together.

  • jsx-ast builds pages as their entries arrive and yields them in that order, then a { manifest } item with every page's head once all have arrived. To list pages as the site does, headingSortFn is now exported at @doc-kit/generator-react/jsx-ast/utils/getSortedHeadNodes. This is a breaking change for anything reading jsx-ast's output.
  • html compiles each page as it arrives, bundles the component library and the client assets as soon as the manifest does, and has the workers render the pages as they're compiled. Bundler adapters' compile can now run before and alongside buildServer and buildClient; the html README says so.
  • createChannel is the queue html hands its compiled pages to the workers on, and merge yields from several async iterables as items arrive: jsx-ast announces the manifest next to its pages with it.

Validation

Added tests for createChannel and merge, for jsx-ast starting pages as they arrive and building the same pages from its whole input, and for html with the manifest (bundling once the manifest arrives and compiling all.html once its parts are, building the same site from its whole input as with one thread, and a failing input leaving no temporary files and writing no page still waiting for a worker). Built on 12 of Node.js's API docs at 1 and 4 threads, the output is byte-identical to main's.

Related Issues

Refs: #1205

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:check & node --run lint.
  • I've covered new added functionality with unit tests if necessary.

With more than one thread, jsx-ast builds pages as their entries arrive
and html compiles, bundles and renders them as it receives them, so
page building and rendering overlap with the generators before them.
The generated files are unchanged.

jsx-ast yields its pages in the order their entries arrived, and once
every page has, a { manifest } item with all their heads in that order.
html compiles each page as it comes, bundles the component library and
the client assets as soon as the manifest does, and has the workers
render the pages as they are compiled. To list the pages as the site
does, headingSortFn is now exported. Bundler adapters' compile can now
run before and alongside buildServer and buildClient.

createChannel is the queue html hands its compiled pages to the workers
on, and merge yields from several async iterables as items arrive: jsx-ast
announces the manifest next to its pages with it.

Assisted-by: Claude Opus 5.5 <noreply@anthropic.com>
Assisted-by: Claude Sonnet 5.5 <noreply@anthropic.com>
@vercel

vercel Bot commented Nov 3, 2026 •

Copy link
Copy Markdown

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

Project Deployment Actions Updated
api-docs-tooling Ready Ready Preview Nov 3, 2026 7:35pm UTC

Request Review

@codecov

codecov Bot commented Nov 3, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 99.72603% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 94.61%. Comparing base (deb7a89) to head (65d6aeb).

Files with missing lines Patch % Lines
...kages/core/src/utils/__tests__/generators.test.mjs 94.44% 3 Missing ⚠️
Additional details and impacted files
@@                   Coverage Diff                    @@
##           perf/stream-metadata    #1241      +/-   ##
========================================================
+ Coverage                 94.43%   94.61%   +0.17%     
========================================================
  Files                       293      295       +2     
  Lines                     30683    31659     +976     
  Branches                   3128     3227      +99     
========================================================
+ Hits                      28976    29953     +977     
+ Misses                     1685     1684       -1     
  Partials                     22       22              

☔ View full report in Codecov by Harness.
📢 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.

@cloudflare-workers-and-pages

Copy link
Copy Markdown

🚀 Deploying Preview to Cloudflare 🚀

Preview Deployments by commit

Status Deployment URL Commit Updated (UTC) See this deployment's details
  • Build: Success ✅

View logs ↗
No Preview URL. Enable ↗ 65d6aeb 2026-11-03T19:36:00.177Z View logs ↗

@ovflowd
ovflowd marked this pull request as ready for review November 3, 2026 20:39
@ovflowd
ovflowd requested a review from a team as a code owner November 3, 2026 20:39

This branch was successfully deployed

1 active deployment
Preview – api-docs-tooling — 65d6aeb4 Deployed Nov 3, 2026 by vercel[bot]
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.

1 participant