Skip to content

stream: minor stream/iter implementation edits#63132

Open
Renegade334 wants to merge 1 commit intonodejs:mainfrom
Renegade334:iterstream-copyedits
Open

stream: minor stream/iter implementation edits#63132
Renegade334 wants to merge 1 commit intonodejs:mainfrom
Renegade334:iterstream-copyedits

Conversation

@Renegade334
Copy link
Copy Markdown
Member

Changes:

  • Splits out arrayBufferViewToUint8Array() from primitiveToUint8Array(), as transform processing makes extensive use of this utility but exclusively to handle ABVs, which allows these cases to shortcut the other chunk typechecks.
  • Uses flattenTransformYieldSync() to flatten sync iterables in async pipelines. The spec text is not entirely clear how these cases should be flattened, but extrapolated from how sync iterables are handled in async from(), they should be handled the same as if they were being flattened in a sync pipeline, ie. they must not yield nested async iterators.
  • Add a fast path to concatBytes() for cloning a single chunk, by passing the chunk directly to the Uint8Array constructor.
  • Replaces the dependency on Buffer.concat() in concatBytes() with a thin inline concatenation implementation.
  • Uses yield* in withFlushAsync(): the operator preferentially async-iterates its target within an async generator, without the need to unwrap the iteration.
  • Adds some remaining array prototype primordials for consistency.

Pseudo-tested by running the new-stream samples, which shows no changes between this PR and main.

Signed-off-by: Renegade334 <contact.9a5d6388@renegade334.me.uk>
@Renegade334 Renegade334 requested a review from jasnell May 5, 2026 17:14
@nodejs-github-bot
Copy link
Copy Markdown
Collaborator

Review requested:

  • @nodejs/streams

@nodejs-github-bot nodejs-github-bot added lib / src Issues and PRs related to general changes in the lib or src directory. needs-ci PRs that need a full CI run. labels May 5, 2026
@codecov
Copy link
Copy Markdown

codecov Bot commented May 5, 2026

Codecov Report

❌ Patch coverage is 88.88889% with 7 lines in your changes missing coverage. Please review.
✅ Project coverage is 89.68%. Comparing base (6df4f7b) to head (0b28453).
⚠️ Report is 3 commits behind head on main.

Files with missing lines Patch % Lines
lib/internal/streams/iter/pull.js 60.00% 6 Missing ⚠️
lib/internal/streams/iter/classic.js 83.33% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main   #63132   +/-   ##
=======================================
  Coverage   89.67%   89.68%           
=======================================
  Files         712      712           
  Lines      221251   221267   +16     
  Branches    42391    42394    +3     
=======================================
+ Hits       198405   198438   +33     
+ Misses      14669    14646   -23     
- Partials     8177     8183    +6     
Files with missing lines Coverage Δ
lib/internal/streams/iter/consumers.js 96.56% <100.00%> (+<0.01%) ⬆️
lib/internal/streams/iter/from.js 88.81% <100.00%> (+0.09%) ⬆️
lib/internal/streams/iter/utils.js 100.00% <100.00%> (ø)
lib/internal/streams/iter/classic.js 89.34% <83.33%> (+0.01%) ⬆️
lib/internal/streams/iter/pull.js 85.16% <60.00%> (ø)

... and 38 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

lib / src Issues and PRs related to general changes in the lib or src directory. needs-ci PRs that need a full CI run.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants