Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
238 commits
Select commit Hold shift + click to select a range
afca0a9
crypto: support loading private keys through STORE loaders
panva Aug 2, 2026
32ead10
test_runner: fix env option validation
hanityx Aug 4, 2026
cc9ee6c
buffer: treat detached ArrayBuffers as empty
Archkon Aug 5, 2026
ceb0e99
tools: sync mk-ca-bundle.pl with curl
Archkon Aug 5, 2026
b48699e
doc: correct default highWaterMark values
umuoy1 Aug 5, 2026
8c11bea
src: update repeated use strings to env
jasnell Aug 5, 2026
9ffc0da
url: handle unparsable serialized URLs in setters
mcollina Aug 5, 2026
a0a1239
doc: document ArrayBuffer support in pbkd2Sync
kyungrae2002 Aug 5, 2026
35c635b
util: add non-throwing MIMEType.parse
jasnell Aug 5, 2026
7e27910
test: update WPT for WebCryptoAPI to 82c3d9069c
nodejs-github-bot Aug 5, 2026
7f21e37
src: report why --enable-fips failed
panva Aug 5, 2026
9b2ca70
doc: remove `--expose-gc` flag from CLI documentation
dario-piotrowicz Aug 5, 2026
6ed1e38
crypto: fix disabling FIPS mode
panva Aug 3, 2026
2d21f41
build: handle malformed OpenSSL macros
panva Aug 3, 2026
89a6724
build: check FIPS option value in node.gyp
panva Aug 3, 2026
44c0c8f
doc: clarify OpenSSL FIPS configuration
panva Aug 3, 2026
c0a8ef6
esm: fix wasm import name in error message
hyemimi Aug 5, 2026
fbe8861
sqlite: bind ArrayBuffer
mike-git374 Aug 5, 2026
cfad1d5
meta: update sccache to 0.17.0
Renegade334 Aug 5, 2026
cdb732b
sqlite: fix undefined behaviour in `Session::Changeset()`
ndossche Aug 6, 2026
c154225
sqlite: bind Boolean
mike-git374 Feb 26, 2026
37b9e9a
dns: fix crash on setServers with port 0
lazerg Aug 6, 2026
41c7062
net: improve performance of net.BlockList
jasnell Aug 3, 2026
212fe77
fs: add windowsHandle option to file streams
PickBas Aug 6, 2026
b0c1277
test: increase timeout in probe-failure-hang-during-evaluate
joyeecheung Aug 6, 2026
b89c8f5
stream: fix recursive WritableStream abort
standard-Chan Aug 6, 2026
d82a616
doc: fix grammar in worker_threads.md
hyemimi Aug 6, 2026
b055a43
src: expose Windows-only fs open flags
PickBas Aug 7, 2026
f41509b
tools: lazy-abort failed PR merges in CQ
aduh95 Aug 7, 2026
514e3f3
sqlite: clear SQLTagStore bindings
mcollina Aug 7, 2026
314f9b2
doc: remove usage of `util.inherits`
AugustinMauroy Aug 7, 2026
15f95fc
dns: validate port range in `setServers()`
Renegade334 Aug 7, 2026
8f3d01b
meta: add Aviv Keller to `.mailmap`
avivkeller Aug 7, 2026
2ba198d
doc: clarify sqlite bare parameter default
skdas20 Aug 8, 2026
5e1db5a
tools: prefilter commit queue metadata
panva Aug 8, 2026
61a0463
sqlite: reject non-positive backup rates
trivikr Aug 8, 2026
cf7680e
test: use libuv clock for immediate queue test
trivikr Aug 1, 2026
0d7c793
tools: move ncu config to global for commit queue
panva Aug 8, 2026
00f4240
test: update passphrases to comply with the next OpenSSL FIPS mode
panva Aug 8, 2026
5858c2b
zlib: validate pledgedSrcSize for sync zstd
Archkon Jul 19, 2026
dcf65c5
tls: fix authorized state on no-cert TLS1.3 client cert resumption
pimterry Aug 8, 2026
39ea929
doc: document quic stopSending() and resetStream()
theSnackOverflow Aug 8, 2026
d7463b9
src: reuse cached env strings in remaining files
leah-1ee Aug 8, 2026
cd84d55
esm: only register text format when enabled
efekrskl Aug 8, 2026
d6d2a71
sqlite: validate maxSize argument in createTagStore()
Anshikakalpana Aug 8, 2026
5234a51
doc: finalize statements in sqlite examples
araujogui Aug 8, 2026
424fe2b
lib: add and test [EnforceRange] in webcrypto dictionaries
panva Aug 8, 2026
cd776fe
quic: fix infinite loop if STOP_SENDING received on a buffering stream
pimterry Aug 8, 2026
b7932e6
doc: document sqlite parameter binding
araujogui Aug 8, 2026
88bee43
quic: convert incoming :status header to number
hallss93 Aug 9, 2026
4b90031
http: emit drain on socket takeover and avoid stale HWM reuse
trivenay Aug 3, 2026
c8837e1
benchmark: add test runner hooks and options
luanmuniz Aug 9, 2026
b8faee0
sqlite: check null returns from sqlite value functions
ndossche Aug 9, 2026
1bf7737
doc: fix permission documentation examples
greenheadHQ Aug 9, 2026
ac11f88
test,doc: cover and document multi-byte offset/size in randomFill
kyungrae2002 Aug 9, 2026
be25cdd
doc: report proper return type on urlPattern.test
bmuenzenmeyer Aug 9, 2026
7d9dcfa
tools: delay removal of `commit-queue` label
aduh95 Aug 9, 2026
39f4c83
doc: fix broken internal links
greenheadHQ Aug 9, 2026
7e8c2c9
lib: use validateArray for array arguments
greenheadHQ Aug 9, 2026
8e2461d
url: bounds-check short Windows file URL paths
Archkon Jul 27, 2026
151ca7e
lib: harden webidl dictionary member reads
panva Aug 7, 2026
c990140
src: match cmd.exe case-insensitively in task runner
Archkon Aug 9, 2026
703b854
sea: reject trailing content in config JSON
Archkon Aug 9, 2026
ec5e2d6
sea: handle NUL bytes in asset keys
Archkon Aug 9, 2026
2ba7406
sea: avoid dangling CLI option pointers
Archkon Aug 9, 2026
e624785
tools: use the read-only token when filtering PRs in CQ
aduh95 Aug 9, 2026
dff2b67
process: validate resource stats array offsets
Archkon Aug 7, 2026
e4b1e3e
test: allow half-open CONNECT tunnel sockets
trivikr Aug 3, 2026
881f8d0
test: avoid deadlock issue in pipeline http2 tests to fix flakiness
pimterry Aug 9, 2026
dac2573
tools: fix GITHUB_TOKEN permissions for CQ workflow
aduh95 Aug 10, 2026
7827485
tools: bump js-yaml from 4.2.0 to 4.3.1 in /tools/eslint
dependabot[bot] Aug 10, 2026
60bfa16
tools: bump js-yaml from 4.2.0 to 4.3.1 in /tools/lint-md
dependabot[bot] Aug 10, 2026
273e72d
build: deprecate always enabled `--enable-static`
legendecas Aug 10, 2026
d45c010
test: fix hidden error in test-http-server-stale-close.js
nektro Aug 10, 2026
96b4af1
deps: update googletest to d89aac5f0dd4021198d903d39de16f896726de21
nodejs-github-bot Aug 11, 2026
2aa2655
test: update WPT for urlpattern to 4832db4761
nodejs-github-bot Aug 11, 2026
550d242
test: update WPT for WebCryptoAPI to 4c2fd05ed5
nodejs-github-bot Aug 11, 2026
043dfe4
sqlite: reject statement-less SQL in SQLTagStore
TrevorBurnham Aug 9, 2026
6ae81be
sqlite: reject statement-less SQL in prepare()
TrevorBurnham Aug 9, 2026
84d706c
assert: improve documentation wording
Rawal27 Aug 11, 2026
6d9999f
tools: remove skip logic in `commit-queue.sh`
aduh95 Aug 11, 2026
4ad043b
deps: enable AVX-512 OpenSSL asm with clang
lemire Aug 11, 2026
c3b120e
doc: update synopsis
AugustinMauroy Aug 11, 2026
d01dda7
test_runner: do not tag-filter test file wrappers
atlowChemi Aug 11, 2026
c8625a4
src: add SetAbortHandler
maxhfisher Jul 22, 2026
f15e8c9
typings: add credentials internal binding types
HoonDongKang Aug 12, 2026
0529772
lib,src: improve histogram implementation
jasnell Aug 4, 2026
ac8a68e
tools: only include fast-tracked and old enough PRs in CQ
aduh95 Aug 12, 2026
18e16e7
src: cache permission strings
jasnell Aug 8, 2026
968b2ca
src: use DictionaryTemplate for permission diag channel message
jasnell Aug 9, 2026
8e831a3
src: make minor cleanup to permission checks
jasnell Aug 9, 2026
a0f3c62
src: simplify c++ diagnostics channel API
jasnell Aug 9, 2026
f471114
doc: create ai-guidelines and include to CONTRIBUTING
RafaelGSS Aug 12, 2026
ca1c67b
deps: float ICU-23262 patch for icu78
Renegade334 Aug 12, 2026
961bd04
module: fix --check on ambiguous ESM files
bitpshr Aug 12, 2026
f9c21ea
stream: use validateBuffer for BYOB reader view
greenheadHQ Aug 13, 2026
7defefa
crypto: read WebCrypto inputs through primordials
panva Aug 7, 2026
ac98352
test: account for [EnforceRange] in test-webcrypto-prototype-pollution
panva Aug 9, 2026
f43bed0
http2: avoid uaf while receiving and sending rst_stream
Eusgor Jul 17, 2026
a9bd780
crypto: remove obsolete BoringSSL shims
panva Aug 20, 2026
8029383
crypto: use available BoringSSL APIs
panva Aug 20, 2026
5ded71f
test: cover `realpathSync` resolving symlinks after a FIFO stat
unstubbable Aug 13, 2026
cea9786
util: preserve function names without source map names
privatenumber Aug 13, 2026
22e5023
src: escape Windows environment variables in task runner
aduh95 Aug 13, 2026
ed7ba3c
benchmark: complete the sqlite is-transaction fix
geeksilva97 Aug 13, 2026
f85b6ec
meta: move one or more collaborators to emeritus
nodejs-github-bot Aug 13, 2026
c57c83b
typings: add internal_only_v8 binding typeis
HoonDongKang Aug 14, 2026
d7accdc
doc: document http2 header constants
harjothkhara Aug 14, 2026
b41b07c
meta: add unified http api initiative
jasnell Aug 14, 2026
b42d664
inspector: avoid calling into JS from V8 interrupts
joyeecheung Aug 14, 2026
670b366
deps: cherry-pick libuv/libuv@e640dc9
Aug 14, 2026
c3eb51d
doc: document open pull request limit
mcollina Aug 14, 2026
d631e91
stream: preserve falsy cancellation reasons
trivikr Aug 14, 2026
1d8f045
benchmark: apply `highWaterMark` in webstreams `pipe-to`
mcollina Aug 8, 2026
c577669
stream: cut promise churn in webstreams hot paths
mcollina Aug 8, 2026
859ea01
stream: consolidate non-op algorithm callbacks
mcollina Aug 8, 2026
113b808
doc: fix SQLite changeset constant descriptions
greenheadHQ Aug 15, 2026
ddc41c1
quic: fix wake up blob
martenrichter Aug 15, 2026
f82060c
test: use for-of instead of forEach
devfep Aug 15, 2026
a60572a
test: convert forEach to for in test-constant.js file
Nixxy25 Aug 13, 2026
8d6b89f
test: replace `forEach()` with `for...of` in parallel tests
pmarkert Aug 15, 2026
ba87603
test: convert test-async-local-storage-bind to async loop
freida-code Aug 13, 2026
3165b5d
doc: add missing `added:` tags to `fs.lchmod`
lazerg Aug 16, 2026
0b1fb8f
doc: fix typo in onboarding.md
minirang Aug 17, 2026
39ecedb
doc: fix lint clean command
greenheadHQ Aug 17, 2026
3a174ce
stream: use validateNumber for BYOB reader options.min
greenheadHQ Aug 17, 2026
74d53bd
stream: use validateObject for zlib/iter params
greenheadHQ Aug 17, 2026
386ed6a
stream: avoid leaking consumers on signal failure
trivikr Aug 17, 2026
e64de34
typings: add watchdog internal binding types
leah-1ee Aug 17, 2026
b103a4a
typings: add diagnostics_channel typings
leah-1ee Aug 17, 2026
9b9dd6e
debugger: wait for target startup
panva Aug 10, 2026
a40bfc7
typings: add signal_wrap internal binding types
leah-1ee Aug 17, 2026
64c20b4
util: use more primordials in `comparisons.js`
Ayoub-Mabrouk Aug 17, 2026
6ff69ba
test: enforce exit code in `test-http-server-stale-close`
aduh95 Aug 17, 2026
cd1e6ce
repl: add benchmarks
avivkeller Jul 19, 2026
04785c8
http: fix keylog listener setup on existing agent sockets
shani-singh1 Aug 17, 2026
5a5d73e
build: pass target architecture to small-icu genccode
Aug 17, 2026
fe0e4f1
test: avoid timer race in event loop delay test
trivikr Jul 25, 2026
3e58e48
deps: update googletest to 49495eacfdbda3f4b6ba219923fedbb2e3f99376
nodejs-github-bot Aug 18, 2026
4533572
doc: add missing return types in buffer.md
inoway46 Aug 18, 2026
a1e9c3a
doc: add missing return types in fs.md
chasetonco Aug 18, 2026
2480acb
doc: document setRawMode write access on Windows
edemaine Aug 18, 2026
6f9b9df
doc: clarify copyFile symlink behavior
cookesan Aug 18, 2026
9b92fdc
doc: update security release prepare command
RafaelGSS Aug 18, 2026
64cd3a6
doc: clarify how fs.Dirent file types are determined
soreavis Aug 18, 2026
b8a7a75
stream: reject pull on signal abort during flush
trivikr Aug 19, 2026
a61a5fd
sqlite: prevent reentrant session.close()
trivikr Aug 19, 2026
bd21e67
module: cache nearest parent package.json per directory
codebytere Aug 19, 2026
2ba8661
buffer: prevent string write offset overflow
mcollina Aug 19, 2026
6a248ac
test_runner: fix junit report on empty diagnostic
lazerg Aug 19, 2026
7809f11
doc: clarify that ipv4 mapped to ipv6 are classified as ipv6
gamemaker1 Aug 19, 2026
94b118d
diagnostics_channel: validate before channel activation
trivikr Aug 20, 2026
86d1196
stream: decouple transform backpressure changes
mcollina Aug 20, 2026
9017f4a
quic: do not destroy incoming streams that have a consumer
trivenay Aug 20, 2026
b269616
fs: treat `std::errc::permission_denied` as `EPERM` error
PickBas Aug 20, 2026
f62bc0f
build,win: add PGO workload scripts
StefanStojanovic Aug 20, 2026
18a7ccf
quic: write desired size needs update on maxstream
martenrichter Jul 26, 2026
67697de
tools: make env variables consistent in cron jobs
aduh95 Aug 20, 2026
e7a68bc
test_runner: add classname hierarchy for JUnit reporter
mag123c Aug 20, 2026
c2aa446
deps: update simdjson to 4.6.7
nodejs-github-bot Aug 20, 2026
6bdcd12
deps: update zlib to 1.3.2.1-motley-8002e91
nodejs-github-bot Aug 20, 2026
349c53c
module: report unreadable package.json
bitpshr Aug 20, 2026
419af8b
crypto: fix missing error checks on ASN1_STRING_to_UTF8()
ndossche Aug 20, 2026
c358761
fs: fix out-of-bounds write in mkdtemp for long prefixes
frandle331-yh Aug 20, 2026
bbe7651
tools: bump brace-expansion in `/tools/clang-format`
dependabot[bot] Aug 21, 2026
0978866
dns: validate address type in lookupService
lazerg Aug 21, 2026
33d0c7d
child_process: keep SIGWINCH from killing on Win
PickBas Aug 21, 2026
6438c70
test: fix Linux debug skip in SEA test guard
guhyunwoo Aug 21, 2026
a7e8269
doc: update outdated nodejs.org guide links
HoonDongKang Aug 21, 2026
290c1fe
doc: clarify socket destroyed behavior
dayun6530 Aug 21, 2026
06c7684
test: use common/child_process spawnSync helpers
ganjanggejang Aug 21, 2026
bc1f271
tools: fix max body length handler in `create-release-proposal.sh`
aduh95 Aug 21, 2026
fde6776
doc: fix broken TLS security level example
soreavis Aug 21, 2026
186e1b7
meta: move targos to emeritus
targos Aug 21, 2026
45c4011
doc: document that an empty OPENSSL_CONF skips config loading
orgads Aug 21, 2026
339acf4
test_runner: mock dual-package with conditional exports
maruthang Apr 25, 2026
7cb9c9c
test_runner: use run options with isolation="none"
inukshuk Mar 15, 2026
f45ef73
net: handle undefined parent in _unrefTimer and _destroy
Shivay-98 Jul 21, 2026
38fdbb6
test: deflake test-net-listen-ipv6only
Han5991 Aug 22, 2026
b13f425
doc: fix broken GYP link in n-api.md
HoonDongKang Aug 22, 2026
10cbb6d
util: fix formatting of functions returned from getters
gibson042 Aug 22, 2026
eb36462
doc: remove outdated WASI version fallback
hyemimi Aug 22, 2026
b0f54bd
tools: improve commit queue failure comment
panva Aug 22, 2026
ad1d788
benchmark: add test-only and mock timers cases
luanmuniz Aug 22, 2026
48d9cd4
http: cache maxHeaderPairs per header section
GetThatCookie Aug 22, 2026
ea5935b
src: fix out-of-bounds write when transcoding odd-length ucs2
Nashit-h Aug 22, 2026
fcb4333
fs: allocate FSReqPromise stat arrays lazily
MarshallOfSound Aug 22, 2026
bc54dd8
fs: pass symlink type in cp when filter is provided
shulaoda Aug 22, 2026
7d5428c
url: speed up URLSearchParams
anonrig Aug 22, 2026
b06c61a
test_runner: print coverage and diagnostic info with dot reporter
mag123c Jan 18, 2026
0312ee1
esm: avoid super-linear data URL MIME regex
skdas20 Aug 22, 2026
a98e27f
test: add Headers coverage and benchmark
anonrig Aug 22, 2026
4ec4fab
stream: avoid duplicated endReadableNT scheduling
mcollina Aug 23, 2026
2460b17
quic: reset rejected HTTP/3 request streams with H3_REQUEST_REJECTED
trivenay Aug 23, 2026
774f663
dgram: don't swallow bind errors when callback is provided
armanmikoyan Aug 23, 2026
6bf8521
lib: use bracket notation instead of startsWith/endsWith for single char
kimtaejin3 Aug 23, 2026
58390f8
url: speed up WHATWG URL parsing
anonrig Aug 18, 2026
a500256
url: skip unused href reuse comparison
anonrig Aug 19, 2026
a4c770c
quic: mark drain promise handled
jasnell Aug 23, 2026
c9233b9
fs: fix glob early return skipping sibling entries
webdevelopersrinu Aug 23, 2026
f277983
quic: changes for nghttp3_conn_close_stream2
martenrichter Aug 23, 2026
f38f154
test: simplify test-timers-interval-promisified.js
HoonDongKang Aug 23, 2026
034a827
doc: fix broken links in cli.md
HoonDongKang Aug 23, 2026
929d570
test: remove test-debugger-run-after-quit-restart as flaky on macOS
inoway46 Aug 23, 2026
421ee11
test: use spawnSyncAndAssert in windowsHide test
ganjanggejang Aug 23, 2026
7d135d2
test: convert forEach to for of test-messageevent-brandcheck file
nachiketap11 Aug 23, 2026
6b8b9c3
stream: reuse unexposed managed read buffers
GetThatCookie Aug 23, 2026
67da38c
test_runner: match dotfiles in default coverage exclude
semimikoh Aug 23, 2026
600663b
tty: add raw-vt and io raw modes
samuel-williams-shopify Aug 23, 2026
4f6eda3
repl: keep entries added while history file is loading
mhayk Aug 23, 2026
0e6f9ae
doc: fix property names in os.networkInterfaces() example
hanityx Aug 23, 2026
93d822b
stream: drain pending writes before broadcast end
trivikr Aug 16, 2026
5197b5a
perf_hooks: add statistical hypothesis testing to histogram
jasnell Aug 20, 2026
90d127d
benchmark: add --analyze mode to compare.js
jasnell Aug 20, 2026
793cf69
src: fix heap value deduplication in embedder graph
IlyasShabi Aug 23, 2026
1640682
stream: prevent share from eagerly draining source
trivikr Aug 23, 2026
b68a7c3
util: fix OSC 8 hyperlink stripping in stripVTControlCharacters
dushyant-hada-90 Aug 24, 2026
8a5b1ae
fs: fix realpath of namespaced drive paths
jazelly Aug 24, 2026
367549e
fs: use sized reads for large files in readFileUtf8
codebytere Aug 24, 2026
75df6cb
http: improve performance with known-length calls to end()
pimterry Aug 24, 2026
1722dda
permission: enforce addon permission in GetLinkedBinding
RafaelGSS Aug 24, 2026
b0ef155
tls: throw on invalid ALPNProtocols instead of aborting
sankalpsthakur Aug 24, 2026
fa9d4e0
util: allow single-line format when break length is infinite
hamidrezaghavami Aug 24, 2026
cd6205f
doc: update AHAFS reference link
ChocoChip0519 Aug 24, 2026
107e96d
stream: encode whole chunks in TextEncoderStream
mcollina Aug 24, 2026
71106e1
crypto: update root certificates to NSS 3.126
nodejs-github-bot Aug 25, 2026
9e2c477
stream: normalize fused stateless transform results
trivikr Aug 25, 2026
6ee4b40
events: inline createEvent hybrid dispatch closure
slagiewka Jul 13, 2026
e6c34f9
events: inline iterationCondition hybrid dispatch closure
slagiewka Jul 13, 2026
6274fcc
deps: upgrade openssl sources to openssl-3.5.8
nodejs-github-bot Aug 25, 2026
0268ca5
deps: update archs files for openssl-3.5.8
nodejs-github-bot Aug 25, 2026
1433cf9
test: account for varied OpenSSL CCM final behaviours
panva Aug 26, 2026
39e0457
test: fix link-local dgram scope assertion
panva Aug 28, 2026
53cba01
deps: update undici to 7.29.1
nodejs-github-bot Sep 7, 2026
07faaee
deps: update corepack to 0.36.0
nodejs-github-bot Sep 1, 2026
e3c6bd6
src: add missing vector include
panva Aug 30, 2026
83a2755
http2: adapt receive deferral for Node.js 24
mcollina Jul 17, 2026
955266b
2026-09-08, Version 24.21.0 'Krypton' (LTS)
aduh95 Sep 7, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
stream: normalize fused stateless transform results
Normalize each stateless transform result before passing it to
the next transform in a fused run. This ensures that subsequent
transforms always receive Uint8Array[] batches in both synchronous
and asynchronous pipelines.

Signed-off-by: Kamat, Trivikram <[email protected]>
Assisted-by: codex:gpt-5.6-sol
PR-URL: #65367
Fixes: #65366
Reviewed-By: James M Snell <[email protected]>
  • Loading branch information
trivikr authored and aduh95 committed Sep 7, 2026
commit 9e2c477e26df8b084f7c9bc3a4ec87ff64975931
43 changes: 33 additions & 10 deletions lib/internal/streams/iter/pull.js
Original file line number Diff line number Diff line change
Expand Up @@ -434,6 +434,16 @@ async function appendTransformResultAsyncSlow(target, result) {
}
}

function normalizeTransformResultFast(result) {
if (isUint8ArrayBatch(result)) {
return result.length === 0 ? null : result;
}
if (isUint8Array(result)) return [result];
if (typeof result === 'string') return [toUint8Array(result)];
if (isAnyArrayBuffer(result)) return [new Uint8Array(result)];
if (ArrayBufferIsView(result)) return [arrayBufferViewToUint8Array(result)];
}

// =============================================================================
// Sync Pipeline Implementation
// =============================================================================
Expand All @@ -457,7 +467,17 @@ function* applyFusedStatelessSyncTransforms(source, run) {
current = null;
break;
}
current = result;
if (i === run.length - 1) {
current = result;
continue;
}
current = normalizeTransformResultFast(result);
if (current === undefined) {
const normalized = [];
appendTransformResultSync(normalized, result);
current = normalized.length === 0 ? null : normalized[0];
}
if (current === null) break;
}
if (current === null) continue;
// Inline normalization with Uint8Array[] batch as the fast path,
Expand Down Expand Up @@ -570,21 +590,24 @@ async function* applyFusedStatelessAsyncTransforms(source, run, signal) {
for await (const chunks of source) {
let current = chunks;
for (let i = 0; i < run.length; i++) {
const result = run[i](current, { __proto__: null, signal });
let result = run[i](current, { __proto__: null, signal });
if (isPromise(result)) result = await result;
if (result === null) {
current = null;
break;
}
if (isPromise(result)) {
const resolved = await result;
if (resolved === null) {
current = null;
break;
}
current = resolved;
} else {
if (i === run.length - 1) {
current = result;
continue;
}
current = normalizeTransformResultFast(result);
if (current === undefined) {
const normalized = [];
const pendingResult = appendTransformResultAsync(normalized, result);
if (pendingResult !== undefined) await pendingResult;
current = normalized.length === 0 ? null : normalized[0];
}
if (current === null) break;
}
if (current === null) continue;
// Normalize the final output
Expand Down
32 changes: 32 additions & 0 deletions test/parallel/test-stream-iter-transform-output.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,36 @@ async function testSyncTransformReturnsFloat32Array() {
assert.strictEqual(data.byteLength, 4);
}

// Consecutive stateless transforms normalize intermediate output (async)
async function testConsecutiveTransformsNormalizeIntermediateOutput() {
const first = (chunks) => {
return chunks === null ? null : new Uint8Array([65]);
};
let receivedBatch = false;
const second = (chunks) => {
if (chunks !== null) receivedBatch = Array.isArray(chunks);
return chunks;
};
const data = await bytes(pull(from('x'), first, second));
assert.ok(receivedBatch);
assert.deepStrictEqual(data, new Uint8Array([65]));
}

// Consecutive stateless transforms normalize intermediate output (sync)
async function testConsecutiveSyncTransformsNormalizeIntermediateOutput() {
const first = (chunks) => {
return chunks === null ? null : new Uint8Array([65]);
};
let receivedBatch = false;
const second = (chunks) => {
if (chunks !== null) receivedBatch = Array.isArray(chunks);
return chunks;
};
const data = bytesSync(pullSync(fromSync('x'), first, second));
assert.ok(receivedBatch);
assert.deepStrictEqual(data, new Uint8Array([65]));
}

// Stateless transform returns a sync generator (iterable)
async function testTransformReturnsGenerator() {
const tx = (chunks) => {
Expand Down Expand Up @@ -233,6 +263,8 @@ Promise.all([
testSyncTransformReturnsArrayBuffer(),
testTransformReturnsFloat32Array(),
testSyncTransformReturnsFloat32Array(),
testConsecutiveTransformsNormalizeIntermediateOutput(),
testConsecutiveSyncTransformsNormalizeIntermediateOutput(),
testTransformReturnsGenerator(),
testSyncTransformReturnsGenerator(),
testTransformReturnsAsyncGenerator(),
Expand Down