Skip to content

Commit 17800ac

Browse files
authored
docs: fix the manifest's timing and the helpers' paths
worker.stream now reads the next batch once there's room for its chunks, so jsx-ast's manifest goes out once every page has been read that way, still without waiting for the pages being built. The changeset also named @doc-kit/core/utils, which isn't a module: createChannel and merge come from utils/channel.mjs and utils/generators.mjs. Assisted-by: Claude Opus 5.5 <noreply@anthropic.com>
1 parent 8e8c749 commit 17800ac

2 files changed

Lines changed: 5 additions & 4 deletions

File tree

‎.changeset/stream-pages.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@
33
'@doc-kit/generator-react': minor
44
---
55

6-
`jsx-ast` and `html` stream their input: with more than one thread, page building and rendering overlap with the generators before them. `html` bundles as soon as every page's metadata is known, and renders pages as they are built. Streaming leaves the generated files unchanged, but `jsx-ast` now yields pages in the order their entries arrive, not the order the site lists them, and, once every page has arrived, a `{ manifest }` item listing their heads in that order. To list the pages as the site does, skip the `{ manifest }` item and sort them with `headingSortFn`, now exported from `@doc-kit/generator-react/jsx-ast/utils/getSortedHeadNodes`, as `pages.toSorted((a, b) => headingSortFn(a.data, b.data))`, keeping the synthetic pages (`data.synthetic`) last. Bundler adapters' `compile` can now be called before and while `buildServer` and `buildClient` run. `createChannel` and `merge`, from `@doc-kit/core/utils`, are the queue and the merge of async iterables they are built on.
6+
`jsx-ast` and `html` stream their input: with more than one thread, page building and rendering overlap with the generators before them. `html` bundles as soon as every page's metadata is known, and renders pages as they are built. Streaming leaves the generated files unchanged, but `jsx-ast` now yields pages in the order their entries arrive, not the order the site lists them, and, once every page has arrived, a `{ manifest }` item listing their heads in that order. To list the pages as the site does, skip the `{ manifest }` item and sort them with `headingSortFn`, now exported from `@doc-kit/generator-react/jsx-ast/utils/getSortedHeadNodes`, as `pages.toSorted((a, b) => headingSortFn(a.data, b.data))`, keeping the synthetic pages (`data.synthetic`) last. Bundler adapters' `compile` can now be called before and while `buildServer` and `buildClient` run. `createChannel`, from `@doc-kit/core/utils/channel.mjs`, and `merge`, from `@doc-kit/core/utils/generators.mjs`, are the queue and the merge of async iterables they are built on.

‎packages/react/src/jsx-ast/generate.mjs‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,10 @@ export async function processChunk(slicedInput, itemIndices) {
5050
* is emitted once built, in the order the pages arrived, the synthetic pages
5151
* last: the `html` generator puts them in the order the site lists them.
5252
*
53-
* Once every page has arrived, without waiting for the pages still being
54-
* built, it also emits `{ manifest }`: every page's head, in that same order,
55-
* so that `html` can prepare what needs the whole site in the meantime.
53+
* Once every page has arrived, which `worker.stream` reads as it has room for
54+
* their chunks, it also emits `{ manifest }`, without waiting for the pages
55+
* still being built: every page's head, in that same order, so that `html` can
56+
* prepare what needs the whole site in the meantime.
5657
*
5758
* @type {import('./types').Generator['generate']}
5859
*/

0 commit comments

Comments
 (0)