88
99const {
1010 ArrayBufferIsView,
11- ArrayFromAsync,
12- ArrayIsArray,
1311 ArrayPrototypePush,
1412 ArrayPrototypeSlice,
1513 FunctionPrototypeCall,
@@ -46,9 +44,7 @@ const {
4644 fromSync,
4745 isSyncIterable,
4846 isAsyncIterable,
49- isPrimitiveChunk,
5047 isUint8ArrayBatch,
51- normalizeAsyncValue,
5248} = require ( 'internal/streams/iter/from' ) ;
5349
5450const {
@@ -62,10 +58,7 @@ const {
6258} = require ( 'internal/streams/iter/utils' ) ;
6359
6460const {
65- kValidatedSource,
6661 kValidatedTransform,
67- toAsyncStreamable,
68- toStreamable,
6962} = require ( 'internal/streams/iter/types' ) ;
7063
7164// =============================================================================
@@ -128,22 +121,6 @@ function parsePipeToArgs(args, requiredMethod) {
128121 } ;
129122}
130123
131- function canUseSyncIterablePipeToFastPath ( source , transforms , signal ) {
132- if ( signal !== undefined ||
133- transforms . length !== 0 ||
134- isPrimitiveChunk ( source ) ||
135- ArrayIsArray ( source ) ||
136- source ?. [ kValidatedSource ] ||
137- ! isSyncIterable ( source ) ||
138- isAsyncIterable ( source ) ) {
139- return false ;
140- }
141-
142- // Preserve from()'s top-level protocol precedence for custom iterables.
143- return typeof source [ toAsyncStreamable ] !== 'function' &&
144- typeof source [ toStreamable ] !== 'function' ;
145- }
146-
147124// =============================================================================
148125// Transform Output Flattening
149126// =============================================================================
@@ -1055,9 +1032,7 @@ async function pipeTo(source, ...args) {
10551032 }
10561033
10571034 const hasWriteSync = typeof writer . writeSync === 'function' ;
1058- const useSyncIterableFastPath =
1059- hasWriteSync && canUseSyncIterablePipeToFastPath ( source , transforms , signal ) ;
1060- const normalized = useSyncIterableFastPath ? undefined : from ( source ) ;
1035+ const normalized = from ( source ) ;
10611036
10621037 let totalBytes = 0 ;
10631038 const hasWritev = typeof writer . writev === 'function' ;
@@ -1118,31 +1093,7 @@ async function pipeTo(source, ...args) {
11181093 }
11191094
11201095 try {
1121- if ( useSyncIterableFastPath ) {
1122- // Avoid from()'s async sync-iterable batching path. This keeps writes
1123- // incremental for synchronous sources while preserving async
1124- // normalization for non-primitive yielded values.
1125- for ( const value of source ) {
1126- if ( isUint8ArrayBatch ( value ) ) {
1127- if ( value . length > 0 ) {
1128- const p = writeBatch ( value ) ;
1129- if ( p ) await p ;
1130- }
1131- continue ;
1132- }
1133- if ( isUint8Array ( value ) ) {
1134- const p = writeBatch ( [ value ] ) ;
1135- if ( p ) await p ;
1136- continue ;
1137- }
1138-
1139- const batch = await ArrayFromAsync ( normalizeAsyncValue ( value ) ) ;
1140- if ( batch . length > 0 ) {
1141- const p = writeBatch ( batch ) ;
1142- if ( p ) await p ;
1143- }
1144- }
1145- } else if ( transforms . length === 0 ) {
1096+ if ( transforms . length === 0 ) {
11461097 // Fast path: no transforms - iterate normalized source directly
11471098 if ( signal ) {
11481099 for await ( const batch of yieldAbortable ( normalized , signal ) ) {
0 commit comments