Skip to content

Commit 54a4f5a

Browse files
authored
docs: point generators that stream their input to toBatches
Every streaming generator reads its input through toBatches, which takes both the stream and the collected array one thread gives, but the docs for writing one only said to accept both. Assisted-by: Claude Opus 5.5 <noreply@anthropic.com>
1 parent c029b6f commit 54a4f5a

2 files changed

Lines changed: 5 additions & 2 deletions

File tree

‎docs/creating-generators.md‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -357,7 +357,9 @@ export default {
357357
```
358358

359359
- A dependency that does not stream arrives as a single chunk.
360-
- With one thread, `input` is still the collected array, so accept both.
360+
- With one thread, `input` is still the collected array, so accept both:
361+
`toBatches(input)`, from `@doc-kit/core/utils/generators.mjs`, gives either
362+
as batches.
361363
- `input` can be iterated only once.
362364
- `metadata`'s chunks hold whole files, and a file is one module, so a chunk
363365
holds all the entries of each module in it.

‎packages/core/src/generators/types.d.ts‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,8 @@ declare global {
7373
/**
7474
* Receive the dependency's output as an async iterable of its chunks, as
7575
* they are produced, instead of one collected array. With one thread, the
76-
* input is still a collected array, so accept both.
76+
* input is still a collected array, so accept both: `toBatches` from
77+
* `@doc-kit/core/utils/generators.mjs` gives either as batches.
7778
*/
7879
streamsInput?: boolean;
7980

0 commit comments

Comments
 (0)