react-server-dom-webpack 19.0.0-rc-9c6806964f-20240703 → 19.0.0-rc-3da26163a3-20240704

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1686,7 +1686,7 @@
1686
1686
  );
1687
1687
  resolveBuffer(response, id, constructor);
1688
1688
  }
1689
- function processFullRow(response, id, tag, buffer, chunk) {
1689
+ function processFullBinaryRow(response, id, tag, buffer, chunk) {
1690
1690
  switch (tag) {
1691
1691
  case 65:
1692
1692
  resolveBuffer(response, id, mergeBuffer(buffer, chunk).buffer);
@@ -1739,6 +1739,9 @@
1739
1739
  )
1740
1740
  row += stringDecoder.decode(buffer[i], decoderOptions);
1741
1741
  row += stringDecoder.decode(chunk);
1742
+ processFullStringRow(response, id, tag, row);
1743
+ }
1744
+ function processFullStringRow(response, id, tag, row) {
1742
1745
  switch (tag) {
1743
1746
  case 73:
1744
1747
  resolveModule(response, id, row);
@@ -1791,24 +1794,24 @@
1791
1794
  break;
1792
1795
  case 69:
1793
1796
  tag = JSON.parse(row);
1794
- buffer = tag.digest;
1795
- chunk = tag.env;
1797
+ var digest = tag.digest,
1798
+ env = tag.env;
1796
1799
  row = Error(
1797
1800
  tag.message ||
1798
1801
  "An error occurred in the Server Components render but no message was provided"
1799
1802
  );
1800
1803
  row.stack = tag.stack;
1801
- row.digest = buffer;
1802
- row.environmentName = chunk;
1804
+ row.digest = digest;
1805
+ row.environmentName = env;
1803
1806
  tag = response._chunks;
1804
- (buffer = tag.get(id))
1805
- ? triggerErrorOnChunk(buffer, row)
1807
+ (digest = tag.get(id))
1808
+ ? triggerErrorOnChunk(digest, row)
1806
1809
  : tag.set(id, new Chunk("rejected", null, row, response));
1807
1810
  break;
1808
1811
  case 84:
1809
1812
  tag = response._chunks;
1810
- (buffer = tag.get(id)) && "pending" !== buffer.status
1811
- ? buffer.reason.enqueueValue(row)
1813
+ (digest = tag.get(id)) && "pending" !== digest.status
1814
+ ? digest.reason.enqueueValue(row)
1812
1815
  : tag.set(id, new Chunk("fulfilled", row, null, response));
1813
1816
  break;
1814
1817
  case 68:
@@ -1877,8 +1880,8 @@
1877
1880
  break;
1878
1881
  default:
1879
1882
  (tag = response._chunks),
1880
- (buffer = tag.get(id))
1881
- ? resolveModelChunk(buffer, row)
1883
+ (digest = tag.get(id))
1884
+ ? resolveModelChunk(digest, row)
1882
1885
  : tag.set(id, new Chunk("resolved_model", row, null, response));
1883
1886
  }
1884
1887
  }
@@ -2022,84 +2025,177 @@
2022
2025
  options && options.findSourceMapURL ? options.findSourceMapURL : void 0
2023
2026
  );
2024
2027
  stream.on("data", function (chunk) {
2025
- for (
2026
- var i = 0,
2027
- rowState = response._rowState,
2028
- rowID = response._rowID,
2029
- rowTag = response._rowTag,
2030
- rowLength = response._rowLength,
2031
- buffer = response._buffer,
2032
- chunkLength = chunk.length;
2033
- i < chunkLength;
2028
+ if ("string" === typeof chunk) {
2029
+ for (
2030
+ var i = 0,
2031
+ rowState = response._rowState,
2032
+ rowID = response._rowID,
2033
+ rowTag = response._rowTag,
2034
+ rowLength = response._rowLength,
2035
+ buffer = response._buffer,
2036
+ chunkLength = chunk.length;
2037
+ i < chunkLength;
2034
2038
 
2035
- ) {
2036
- var lastIdx = -1;
2037
- switch (rowState) {
2038
- case 0:
2039
- lastIdx = chunk[i++];
2040
- 58 === lastIdx
2041
- ? (rowState = 1)
2042
- : (rowID =
2043
- (rowID << 4) |
2044
- (96 < lastIdx ? lastIdx - 87 : lastIdx - 48));
2045
- continue;
2046
- case 1:
2047
- rowState = chunk[i];
2048
- 84 === rowState ||
2049
- 65 === rowState ||
2050
- 79 === rowState ||
2051
- 111 === rowState ||
2052
- 85 === rowState ||
2053
- 83 === rowState ||
2054
- 115 === rowState ||
2055
- 76 === rowState ||
2056
- 108 === rowState ||
2057
- 71 === rowState ||
2058
- 103 === rowState ||
2059
- 77 === rowState ||
2060
- 109 === rowState ||
2061
- 86 === rowState
2062
- ? ((rowTag = rowState), (rowState = 2), i++)
2063
- : (64 < rowState && 91 > rowState) ||
2064
- 114 === rowState ||
2065
- 120 === rowState
2066
- ? ((rowTag = rowState), (rowState = 3), i++)
2067
- : ((rowTag = 0), (rowState = 3));
2068
- continue;
2069
- case 2:
2070
- lastIdx = chunk[i++];
2071
- 44 === lastIdx
2072
- ? (rowState = 4)
2073
- : (rowLength =
2074
- (rowLength << 4) |
2075
- (96 < lastIdx ? lastIdx - 87 : lastIdx - 48));
2076
- continue;
2077
- case 3:
2078
- lastIdx = chunk.indexOf(10, i);
2079
- break;
2080
- case 4:
2081
- (lastIdx = i + rowLength),
2082
- lastIdx > chunk.length && (lastIdx = -1);
2039
+ ) {
2040
+ var lastIdx = -1;
2041
+ switch (rowState) {
2042
+ case 0:
2043
+ lastIdx = chunk.charCodeAt(i++);
2044
+ 58 === lastIdx
2045
+ ? (rowState = 1)
2046
+ : (rowID =
2047
+ (rowID << 4) |
2048
+ (96 < lastIdx ? lastIdx - 87 : lastIdx - 48));
2049
+ continue;
2050
+ case 1:
2051
+ rowState = chunk.charCodeAt(i);
2052
+ 84 === rowState ||
2053
+ 65 === rowState ||
2054
+ 79 === rowState ||
2055
+ 111 === rowState ||
2056
+ 85 === rowState ||
2057
+ 83 === rowState ||
2058
+ 115 === rowState ||
2059
+ 76 === rowState ||
2060
+ 108 === rowState ||
2061
+ 71 === rowState ||
2062
+ 103 === rowState ||
2063
+ 77 === rowState ||
2064
+ 109 === rowState ||
2065
+ 86 === rowState
2066
+ ? ((rowTag = rowState), (rowState = 2), i++)
2067
+ : (64 < rowState && 91 > rowState) ||
2068
+ 114 === rowState ||
2069
+ 120 === rowState
2070
+ ? ((rowTag = rowState), (rowState = 3), i++)
2071
+ : ((rowTag = 0), (rowState = 3));
2072
+ continue;
2073
+ case 2:
2074
+ lastIdx = chunk.charCodeAt(i++);
2075
+ 44 === lastIdx
2076
+ ? (rowState = 4)
2077
+ : (rowLength =
2078
+ (rowLength << 4) |
2079
+ (96 < lastIdx ? lastIdx - 87 : lastIdx - 48));
2080
+ continue;
2081
+ case 3:
2082
+ lastIdx = chunk.indexOf("\n", i);
2083
+ break;
2084
+ case 4:
2085
+ if (84 !== rowTag)
2086
+ throw Error(
2087
+ "Binary RSC chunks cannot be encoded as strings. This is a bug in the wiring of the React streams."
2088
+ );
2089
+ if (rowLength < chunk.length || chunk.length > 3 * rowLength)
2090
+ throw Error(
2091
+ "String chunks need to be passed in their original shape. Not split into smaller string chunks. This is a bug in the wiring of the React streams."
2092
+ );
2093
+ lastIdx = chunk.length;
2094
+ }
2095
+ if (-1 < lastIdx) {
2096
+ if (0 < buffer.length)
2097
+ throw Error(
2098
+ "String chunks need to be passed in their original shape. Not split into smaller string chunks. This is a bug in the wiring of the React streams."
2099
+ );
2100
+ i = chunk.slice(i, lastIdx);
2101
+ processFullStringRow(response, rowID, rowTag, i);
2102
+ i = lastIdx;
2103
+ 3 === rowState && i++;
2104
+ rowLength = rowID = rowTag = rowState = 0;
2105
+ buffer.length = 0;
2106
+ } else if (chunk.length !== i)
2107
+ throw Error(
2108
+ "String chunks need to be passed in their original shape. Not split into smaller string chunks. This is a bug in the wiring of the React streams."
2109
+ );
2083
2110
  }
2084
- var offset = chunk.byteOffset + i;
2085
- if (-1 < lastIdx)
2086
- (rowLength = new Uint8Array(chunk.buffer, offset, lastIdx - i)),
2087
- processFullRow(response, rowID, rowTag, buffer, rowLength),
2088
- (i = lastIdx),
2089
- 3 === rowState && i++,
2090
- (rowLength = rowID = rowTag = rowState = 0),
2091
- (buffer.length = 0);
2092
- else {
2093
- chunk = new Uint8Array(chunk.buffer, offset, chunk.byteLength - i);
2094
- buffer.push(chunk);
2095
- rowLength -= chunk.byteLength;
2096
- break;
2111
+ response._rowState = rowState;
2112
+ response._rowID = rowID;
2113
+ response._rowTag = rowTag;
2114
+ response._rowLength = rowLength;
2115
+ } else {
2116
+ rowLength = 0;
2117
+ chunkLength = response._rowState;
2118
+ rowID = response._rowID;
2119
+ i = response._rowTag;
2120
+ rowState = response._rowLength;
2121
+ buffer = response._buffer;
2122
+ for (rowTag = chunk.length; rowLength < rowTag; ) {
2123
+ lastIdx = -1;
2124
+ switch (chunkLength) {
2125
+ case 0:
2126
+ lastIdx = chunk[rowLength++];
2127
+ 58 === lastIdx
2128
+ ? (chunkLength = 1)
2129
+ : (rowID =
2130
+ (rowID << 4) |
2131
+ (96 < lastIdx ? lastIdx - 87 : lastIdx - 48));
2132
+ continue;
2133
+ case 1:
2134
+ chunkLength = chunk[rowLength];
2135
+ 84 === chunkLength ||
2136
+ 65 === chunkLength ||
2137
+ 79 === chunkLength ||
2138
+ 111 === chunkLength ||
2139
+ 85 === chunkLength ||
2140
+ 83 === chunkLength ||
2141
+ 115 === chunkLength ||
2142
+ 76 === chunkLength ||
2143
+ 108 === chunkLength ||
2144
+ 71 === chunkLength ||
2145
+ 103 === chunkLength ||
2146
+ 77 === chunkLength ||
2147
+ 109 === chunkLength ||
2148
+ 86 === chunkLength
2149
+ ? ((i = chunkLength), (chunkLength = 2), rowLength++)
2150
+ : (64 < chunkLength && 91 > chunkLength) ||
2151
+ 114 === chunkLength ||
2152
+ 120 === chunkLength
2153
+ ? ((i = chunkLength), (chunkLength = 3), rowLength++)
2154
+ : ((i = 0), (chunkLength = 3));
2155
+ continue;
2156
+ case 2:
2157
+ lastIdx = chunk[rowLength++];
2158
+ 44 === lastIdx
2159
+ ? (chunkLength = 4)
2160
+ : (rowState =
2161
+ (rowState << 4) |
2162
+ (96 < lastIdx ? lastIdx - 87 : lastIdx - 48));
2163
+ continue;
2164
+ case 3:
2165
+ lastIdx = chunk.indexOf(10, rowLength);
2166
+ break;
2167
+ case 4:
2168
+ (lastIdx = rowLength + rowState),
2169
+ lastIdx > chunk.length && (lastIdx = -1);
2170
+ }
2171
+ var offset = chunk.byteOffset + rowLength;
2172
+ if (-1 < lastIdx)
2173
+ (rowState = new Uint8Array(
2174
+ chunk.buffer,
2175
+ offset,
2176
+ lastIdx - rowLength
2177
+ )),
2178
+ processFullBinaryRow(response, rowID, i, buffer, rowState),
2179
+ (rowLength = lastIdx),
2180
+ 3 === chunkLength && rowLength++,
2181
+ (rowState = rowID = i = chunkLength = 0),
2182
+ (buffer.length = 0);
2183
+ else {
2184
+ chunk = new Uint8Array(
2185
+ chunk.buffer,
2186
+ offset,
2187
+ chunk.byteLength - rowLength
2188
+ );
2189
+ buffer.push(chunk);
2190
+ rowState -= chunk.byteLength;
2191
+ break;
2192
+ }
2097
2193
  }
2194
+ response._rowState = chunkLength;
2195
+ response._rowID = rowID;
2196
+ response._rowTag = i;
2197
+ response._rowLength = rowState;
2098
2198
  }
2099
- response._rowState = rowState;
2100
- response._rowID = rowID;
2101
- response._rowTag = rowTag;
2102
- response._rowLength = rowLength;
2103
2199
  });
2104
2200
  stream.on("error", function (error) {
2105
2201
  reportGlobalError(response, error);
@@ -1299,7 +1299,7 @@ function resolveTypedArray(
1299
1299
  );
1300
1300
  resolveBuffer(response, id, constructor);
1301
1301
  }
1302
- function processFullRow(response, id, tag, buffer, chunk) {
1302
+ function processFullBinaryRow(response, id, tag, buffer, chunk) {
1303
1303
  switch (tag) {
1304
1304
  case 65:
1305
1305
  resolveBuffer(response, id, mergeBuffer(buffer, chunk).buffer);
@@ -1352,6 +1352,9 @@ function processFullRow(response, id, tag, buffer, chunk) {
1352
1352
  )
1353
1353
  row += stringDecoder.decode(buffer[i], decoderOptions);
1354
1354
  row += stringDecoder.decode(chunk);
1355
+ processFullStringRow(response, id, tag, row);
1356
+ }
1357
+ function processFullStringRow(response, id, tag, row) {
1355
1358
  switch (tag) {
1356
1359
  case 73:
1357
1360
  resolveModule(response, id, row);
@@ -1408,14 +1411,15 @@ function processFullRow(response, id, tag, buffer, chunk) {
1408
1411
  row.stack = "Error: " + row.message;
1409
1412
  row.digest = tag;
1410
1413
  tag = response._chunks;
1411
- (buffer = tag.get(id))
1412
- ? triggerErrorOnChunk(buffer, row)
1414
+ var chunk = tag.get(id);
1415
+ chunk
1416
+ ? triggerErrorOnChunk(chunk, row)
1413
1417
  : tag.set(id, new Chunk("rejected", null, row, response));
1414
1418
  break;
1415
1419
  case 84:
1416
1420
  tag = response._chunks;
1417
- (buffer = tag.get(id)) && "pending" !== buffer.status
1418
- ? buffer.reason.enqueueValue(row)
1421
+ (chunk = tag.get(id)) && "pending" !== chunk.status
1422
+ ? chunk.reason.enqueueValue(row)
1419
1423
  : tag.set(id, new Chunk("fulfilled", row, null, response));
1420
1424
  break;
1421
1425
  case 68:
@@ -1442,8 +1446,8 @@ function processFullRow(response, id, tag, buffer, chunk) {
1442
1446
  break;
1443
1447
  default:
1444
1448
  (tag = response._chunks),
1445
- (buffer = tag.get(id))
1446
- ? resolveModelChunk(buffer, row)
1449
+ (chunk = tag.get(id))
1450
+ ? resolveModelChunk(chunk, row)
1447
1451
  : tag.set(id, new Chunk("resolved_model", row, null, response));
1448
1452
  }
1449
1453
  }
@@ -1497,82 +1501,175 @@ exports.createFromNodeStream = function (stream, ssrManifest, options) {
1497
1501
  void 0
1498
1502
  );
1499
1503
  stream.on("data", function (chunk) {
1500
- for (
1501
- var i = 0,
1502
- rowState = response._rowState,
1503
- rowID = response._rowID,
1504
- rowTag = response._rowTag,
1505
- rowLength = response._rowLength,
1506
- buffer = response._buffer,
1507
- chunkLength = chunk.length;
1508
- i < chunkLength;
1504
+ if ("string" === typeof chunk) {
1505
+ for (
1506
+ var i = 0,
1507
+ rowState = response._rowState,
1508
+ rowID = response._rowID,
1509
+ rowTag = response._rowTag,
1510
+ rowLength = response._rowLength,
1511
+ buffer = response._buffer,
1512
+ chunkLength = chunk.length;
1513
+ i < chunkLength;
1509
1514
 
1510
- ) {
1511
- var lastIdx = -1;
1512
- switch (rowState) {
1513
- case 0:
1514
- lastIdx = chunk[i++];
1515
- 58 === lastIdx
1516
- ? (rowState = 1)
1517
- : (rowID =
1518
- (rowID << 4) | (96 < lastIdx ? lastIdx - 87 : lastIdx - 48));
1519
- continue;
1520
- case 1:
1521
- rowState = chunk[i];
1522
- 84 === rowState ||
1523
- 65 === rowState ||
1524
- 79 === rowState ||
1525
- 111 === rowState ||
1526
- 85 === rowState ||
1527
- 83 === rowState ||
1528
- 115 === rowState ||
1529
- 76 === rowState ||
1530
- 108 === rowState ||
1531
- 71 === rowState ||
1532
- 103 === rowState ||
1533
- 77 === rowState ||
1534
- 109 === rowState ||
1535
- 86 === rowState
1536
- ? ((rowTag = rowState), (rowState = 2), i++)
1537
- : (64 < rowState && 91 > rowState) ||
1538
- 114 === rowState ||
1539
- 120 === rowState
1540
- ? ((rowTag = rowState), (rowState = 3), i++)
1541
- : ((rowTag = 0), (rowState = 3));
1542
- continue;
1543
- case 2:
1544
- lastIdx = chunk[i++];
1545
- 44 === lastIdx
1546
- ? (rowState = 4)
1547
- : (rowLength =
1548
- (rowLength << 4) |
1549
- (96 < lastIdx ? lastIdx - 87 : lastIdx - 48));
1550
- continue;
1551
- case 3:
1552
- lastIdx = chunk.indexOf(10, i);
1553
- break;
1554
- case 4:
1555
- (lastIdx = i + rowLength), lastIdx > chunk.length && (lastIdx = -1);
1515
+ ) {
1516
+ var lastIdx = -1;
1517
+ switch (rowState) {
1518
+ case 0:
1519
+ lastIdx = chunk.charCodeAt(i++);
1520
+ 58 === lastIdx
1521
+ ? (rowState = 1)
1522
+ : (rowID =
1523
+ (rowID << 4) | (96 < lastIdx ? lastIdx - 87 : lastIdx - 48));
1524
+ continue;
1525
+ case 1:
1526
+ rowState = chunk.charCodeAt(i);
1527
+ 84 === rowState ||
1528
+ 65 === rowState ||
1529
+ 79 === rowState ||
1530
+ 111 === rowState ||
1531
+ 85 === rowState ||
1532
+ 83 === rowState ||
1533
+ 115 === rowState ||
1534
+ 76 === rowState ||
1535
+ 108 === rowState ||
1536
+ 71 === rowState ||
1537
+ 103 === rowState ||
1538
+ 77 === rowState ||
1539
+ 109 === rowState ||
1540
+ 86 === rowState
1541
+ ? ((rowTag = rowState), (rowState = 2), i++)
1542
+ : (64 < rowState && 91 > rowState) ||
1543
+ 114 === rowState ||
1544
+ 120 === rowState
1545
+ ? ((rowTag = rowState), (rowState = 3), i++)
1546
+ : ((rowTag = 0), (rowState = 3));
1547
+ continue;
1548
+ case 2:
1549
+ lastIdx = chunk.charCodeAt(i++);
1550
+ 44 === lastIdx
1551
+ ? (rowState = 4)
1552
+ : (rowLength =
1553
+ (rowLength << 4) |
1554
+ (96 < lastIdx ? lastIdx - 87 : lastIdx - 48));
1555
+ continue;
1556
+ case 3:
1557
+ lastIdx = chunk.indexOf("\n", i);
1558
+ break;
1559
+ case 4:
1560
+ if (84 !== rowTag)
1561
+ throw Error(
1562
+ "Binary RSC chunks cannot be encoded as strings. This is a bug in the wiring of the React streams."
1563
+ );
1564
+ if (rowLength < chunk.length || chunk.length > 3 * rowLength)
1565
+ throw Error(
1566
+ "String chunks need to be passed in their original shape. Not split into smaller string chunks. This is a bug in the wiring of the React streams."
1567
+ );
1568
+ lastIdx = chunk.length;
1569
+ }
1570
+ if (-1 < lastIdx) {
1571
+ if (0 < buffer.length)
1572
+ throw Error(
1573
+ "String chunks need to be passed in their original shape. Not split into smaller string chunks. This is a bug in the wiring of the React streams."
1574
+ );
1575
+ i = chunk.slice(i, lastIdx);
1576
+ processFullStringRow(response, rowID, rowTag, i);
1577
+ i = lastIdx;
1578
+ 3 === rowState && i++;
1579
+ rowLength = rowID = rowTag = rowState = 0;
1580
+ buffer.length = 0;
1581
+ } else if (chunk.length !== i)
1582
+ throw Error(
1583
+ "String chunks need to be passed in their original shape. Not split into smaller string chunks. This is a bug in the wiring of the React streams."
1584
+ );
1556
1585
  }
1557
- var offset = chunk.byteOffset + i;
1558
- if (-1 < lastIdx)
1559
- (rowLength = new Uint8Array(chunk.buffer, offset, lastIdx - i)),
1560
- processFullRow(response, rowID, rowTag, buffer, rowLength),
1561
- (i = lastIdx),
1562
- 3 === rowState && i++,
1563
- (rowLength = rowID = rowTag = rowState = 0),
1564
- (buffer.length = 0);
1565
- else {
1566
- chunk = new Uint8Array(chunk.buffer, offset, chunk.byteLength - i);
1567
- buffer.push(chunk);
1568
- rowLength -= chunk.byteLength;
1569
- break;
1586
+ response._rowState = rowState;
1587
+ response._rowID = rowID;
1588
+ response._rowTag = rowTag;
1589
+ response._rowLength = rowLength;
1590
+ } else {
1591
+ rowLength = 0;
1592
+ chunkLength = response._rowState;
1593
+ rowID = response._rowID;
1594
+ i = response._rowTag;
1595
+ rowState = response._rowLength;
1596
+ buffer = response._buffer;
1597
+ for (rowTag = chunk.length; rowLength < rowTag; ) {
1598
+ lastIdx = -1;
1599
+ switch (chunkLength) {
1600
+ case 0:
1601
+ lastIdx = chunk[rowLength++];
1602
+ 58 === lastIdx
1603
+ ? (chunkLength = 1)
1604
+ : (rowID =
1605
+ (rowID << 4) | (96 < lastIdx ? lastIdx - 87 : lastIdx - 48));
1606
+ continue;
1607
+ case 1:
1608
+ chunkLength = chunk[rowLength];
1609
+ 84 === chunkLength ||
1610
+ 65 === chunkLength ||
1611
+ 79 === chunkLength ||
1612
+ 111 === chunkLength ||
1613
+ 85 === chunkLength ||
1614
+ 83 === chunkLength ||
1615
+ 115 === chunkLength ||
1616
+ 76 === chunkLength ||
1617
+ 108 === chunkLength ||
1618
+ 71 === chunkLength ||
1619
+ 103 === chunkLength ||
1620
+ 77 === chunkLength ||
1621
+ 109 === chunkLength ||
1622
+ 86 === chunkLength
1623
+ ? ((i = chunkLength), (chunkLength = 2), rowLength++)
1624
+ : (64 < chunkLength && 91 > chunkLength) ||
1625
+ 114 === chunkLength ||
1626
+ 120 === chunkLength
1627
+ ? ((i = chunkLength), (chunkLength = 3), rowLength++)
1628
+ : ((i = 0), (chunkLength = 3));
1629
+ continue;
1630
+ case 2:
1631
+ lastIdx = chunk[rowLength++];
1632
+ 44 === lastIdx
1633
+ ? (chunkLength = 4)
1634
+ : (rowState =
1635
+ (rowState << 4) |
1636
+ (96 < lastIdx ? lastIdx - 87 : lastIdx - 48));
1637
+ continue;
1638
+ case 3:
1639
+ lastIdx = chunk.indexOf(10, rowLength);
1640
+ break;
1641
+ case 4:
1642
+ (lastIdx = rowLength + rowState),
1643
+ lastIdx > chunk.length && (lastIdx = -1);
1644
+ }
1645
+ var offset = chunk.byteOffset + rowLength;
1646
+ if (-1 < lastIdx)
1647
+ (rowState = new Uint8Array(
1648
+ chunk.buffer,
1649
+ offset,
1650
+ lastIdx - rowLength
1651
+ )),
1652
+ processFullBinaryRow(response, rowID, i, buffer, rowState),
1653
+ (rowLength = lastIdx),
1654
+ 3 === chunkLength && rowLength++,
1655
+ (rowState = rowID = i = chunkLength = 0),
1656
+ (buffer.length = 0);
1657
+ else {
1658
+ chunk = new Uint8Array(
1659
+ chunk.buffer,
1660
+ offset,
1661
+ chunk.byteLength - rowLength
1662
+ );
1663
+ buffer.push(chunk);
1664
+ rowState -= chunk.byteLength;
1665
+ break;
1666
+ }
1570
1667
  }
1668
+ response._rowState = chunkLength;
1669
+ response._rowID = rowID;
1670
+ response._rowTag = i;
1671
+ response._rowLength = rowState;
1571
1672
  }
1572
- response._rowState = rowState;
1573
- response._rowID = rowID;
1574
- response._rowTag = rowTag;
1575
- response._rowLength = rowLength;
1576
1673
  });
1577
1674
  stream.on("error", function (error) {
1578
1675
  reportGlobalError(response, error);
@@ -54,7 +54,7 @@
54
54
  ),
55
55
  (currentView = new Uint8Array(2048)),
56
56
  (writtenBytes = 0)),
57
- writeToDestination(destination, textEncoder.encode(chunk));
57
+ writeToDestination(destination, chunk);
58
58
  else {
59
59
  var target = currentView;
60
60
  0 < writtenBytes && (target = currentView.subarray(writtenBytes));
@@ -33,7 +33,7 @@ function writeChunkAndReturn(destination, chunk) {
33
33
  ),
34
34
  (currentView = new Uint8Array(2048)),
35
35
  (writtenBytes = 0)),
36
- writeToDestination(destination, textEncoder.encode(chunk));
36
+ writeToDestination(destination, chunk);
37
37
  else {
38
38
  var target = currentView;
39
39
  0 < writtenBytes && (target = currentView.subarray(writtenBytes));
@@ -54,7 +54,7 @@
54
54
  ),
55
55
  (currentView = new Uint8Array(2048)),
56
56
  (writtenBytes = 0)),
57
- writeToDestination(destination, textEncoder.encode(chunk));
57
+ writeToDestination(destination, chunk);
58
58
  else {
59
59
  var target = currentView;
60
60
  0 < writtenBytes && (target = currentView.subarray(writtenBytes));
@@ -33,7 +33,7 @@ function writeChunkAndReturn(destination, chunk) {
33
33
  ),
34
34
  (currentView = new Uint8Array(2048)),
35
35
  (writtenBytes = 0)),
36
- writeToDestination(destination, textEncoder.encode(chunk));
36
+ writeToDestination(destination, chunk);
37
37
  else {
38
38
  var target = currentView;
39
39
  0 < writtenBytes && (target = currentView.subarray(writtenBytes));