react-server-dom-webpack 19.0.0-rc-9c6806964f-20240703 → 19.0.0-rc-f38c22b244-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.
@@ -1408,7 +1408,8 @@
1408
1408
  encodeFormAction,
1409
1409
  nonce,
1410
1410
  temporaryReferences,
1411
- findSourceMapURL
1411
+ findSourceMapURL,
1412
+ replayConsole
1412
1413
  ) {
1413
1414
  var chunks = new Map();
1414
1415
  this._bundlerConfig = bundlerConfig;
@@ -1423,6 +1424,7 @@
1423
1424
  this._buffer = [];
1424
1425
  this._tempRefs = temporaryReferences;
1425
1426
  this._debugFindSourceMapURL = findSourceMapURL;
1427
+ this._replayConsole = replayConsole;
1426
1428
  this._fromJSON = createFromJSONCallback(this);
1427
1429
  }
1428
1430
  function resolveBuffer(response, id, buffer) {
@@ -1686,7 +1688,7 @@
1686
1688
  );
1687
1689
  resolveBuffer(response, id, constructor);
1688
1690
  }
1689
- function processFullRow(response, id, tag, buffer, chunk) {
1691
+ function processFullBinaryRow(response, id, tag, buffer, chunk) {
1690
1692
  switch (tag) {
1691
1693
  case 65:
1692
1694
  resolveBuffer(response, id, mergeBuffer(buffer, chunk).buffer);
@@ -1739,6 +1741,9 @@
1739
1741
  )
1740
1742
  row += stringDecoder.decode(buffer[i], decoderOptions);
1741
1743
  row += stringDecoder.decode(chunk);
1744
+ processFullStringRow(response, id, tag, row);
1745
+ }
1746
+ function processFullStringRow(response, id, tag, row) {
1742
1747
  switch (tag) {
1743
1748
  case 73:
1744
1749
  resolveModule(response, id, row);
@@ -1791,24 +1796,24 @@
1791
1796
  break;
1792
1797
  case 69:
1793
1798
  tag = JSON.parse(row);
1794
- buffer = tag.digest;
1795
- chunk = tag.env;
1799
+ var digest = tag.digest,
1800
+ env = tag.env;
1796
1801
  row = Error(
1797
1802
  tag.message ||
1798
1803
  "An error occurred in the Server Components render but no message was provided"
1799
1804
  );
1800
1805
  row.stack = tag.stack;
1801
- row.digest = buffer;
1802
- row.environmentName = chunk;
1806
+ row.digest = digest;
1807
+ row.environmentName = env;
1803
1808
  tag = response._chunks;
1804
- (buffer = tag.get(id))
1805
- ? triggerErrorOnChunk(buffer, row)
1809
+ (digest = tag.get(id))
1810
+ ? triggerErrorOnChunk(digest, row)
1806
1811
  : tag.set(id, new Chunk("rejected", null, row, response));
1807
1812
  break;
1808
1813
  case 84:
1809
1814
  tag = response._chunks;
1810
- (buffer = tag.get(id)) && "pending" !== buffer.status
1811
- ? buffer.reason.enqueueValue(row)
1815
+ (digest = tag.get(id)) && "pending" !== digest.status
1816
+ ? digest.reason.enqueueValue(row)
1812
1817
  : tag.set(id, new Chunk("fulfilled", row, null, response));
1813
1818
  break;
1814
1819
  case 68:
@@ -1817,46 +1822,47 @@
1817
1822
  (response._debugInfo || (response._debugInfo = [])).push(row);
1818
1823
  break;
1819
1824
  case 87:
1820
- row = JSON.parse(row, response._fromJSON);
1821
- response = row[0];
1822
- id = row[3];
1823
- tag = row.slice(4);
1824
- b: {
1825
- row = 0;
1826
- switch (response) {
1827
- case "dir":
1828
- case "dirxml":
1829
- case "groupEnd":
1830
- case "table":
1831
- console[response].apply(console, tag);
1832
- break b;
1833
- case "assert":
1834
- row = 1;
1825
+ if (response._replayConsole)
1826
+ b: {
1827
+ (row = JSON.parse(row, response._fromJSON)),
1828
+ (response = row[0]),
1829
+ (id = row[3]),
1830
+ (tag = row.slice(4)),
1831
+ (row = 0);
1832
+ switch (response) {
1833
+ case "dir":
1834
+ case "dirxml":
1835
+ case "groupEnd":
1836
+ case "table":
1837
+ console[response].apply(console, tag);
1838
+ break b;
1839
+ case "assert":
1840
+ row = 1;
1841
+ }
1842
+ tag = tag.slice(0);
1843
+ "string" === typeof tag[row]
1844
+ ? tag.splice(
1845
+ row,
1846
+ 1,
1847
+ "\u001b[0m\u001b[7m%c%s\u001b[0m%c " + tag[row],
1848
+ "background: #e6e6e6;background: light-dark(rgba(0,0,0,0.1), rgba(255,255,255,0.25));color: #000000;color: light-dark(#000000, #ffffff);border-radius: 2px",
1849
+ " " + id + " ",
1850
+ ""
1851
+ )
1852
+ : tag.splice(
1853
+ row,
1854
+ 0,
1855
+ "\u001b[0m\u001b[7m%c%s\u001b[0m%c ",
1856
+ "background: #e6e6e6;background: light-dark(rgba(0,0,0,0.1), rgba(255,255,255,0.25));color: #000000;color: light-dark(#000000, #ffffff);border-radius: 2px",
1857
+ " " + id + " ",
1858
+ ""
1859
+ );
1860
+ "error" === response
1861
+ ? error$jscomp$0.apply(console, tag)
1862
+ : "warn" === response
1863
+ ? warn.apply(console, tag)
1864
+ : console[response].apply(console, tag);
1835
1865
  }
1836
- tag = tag.slice(0);
1837
- "string" === typeof tag[row]
1838
- ? tag.splice(
1839
- row,
1840
- 1,
1841
- "\u001b[0m\u001b[7m%c%s\u001b[0m%c " + tag[row],
1842
- "background: #e6e6e6;background: light-dark(rgba(0,0,0,0.1), rgba(255,255,255,0.25));color: #000000;color: light-dark(#000000, #ffffff);border-radius: 2px",
1843
- " " + id + " ",
1844
- ""
1845
- )
1846
- : tag.splice(
1847
- row,
1848
- 0,
1849
- "\u001b[0m\u001b[7m%c%s\u001b[0m%c ",
1850
- "background: #e6e6e6;background: light-dark(rgba(0,0,0,0.1), rgba(255,255,255,0.25));color: #000000;color: light-dark(#000000, #ffffff);border-radius: 2px",
1851
- " " + id + " ",
1852
- ""
1853
- );
1854
- "error" === response
1855
- ? error$jscomp$0.apply(console, tag)
1856
- : "warn" === response
1857
- ? warn.apply(console, tag)
1858
- : console[response].apply(console, tag);
1859
- }
1860
1866
  break;
1861
1867
  case 82:
1862
1868
  startReadableStream(response, id, void 0);
@@ -1877,8 +1883,8 @@
1877
1883
  break;
1878
1884
  default:
1879
1885
  (tag = response._chunks),
1880
- (buffer = tag.get(id))
1881
- ? resolveModelChunk(buffer, row)
1886
+ (digest = tag.get(id))
1887
+ ? resolveModelChunk(digest, row)
1882
1888
  : tag.set(id, new Chunk("resolved_model", row, null, response));
1883
1889
  }
1884
1890
  }
@@ -2019,87 +2025,181 @@
2019
2025
  options ? options.encodeFormAction : void 0,
2020
2026
  options && "string" === typeof options.nonce ? options.nonce : void 0,
2021
2027
  void 0,
2022
- options && options.findSourceMapURL ? options.findSourceMapURL : void 0
2028
+ options && options.findSourceMapURL ? options.findSourceMapURL : void 0,
2029
+ options ? !0 === options.replayConsoleLogs : !1
2023
2030
  );
2024
2031
  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;
2032
+ if ("string" === typeof chunk) {
2033
+ for (
2034
+ var i = 0,
2035
+ rowState = response._rowState,
2036
+ rowID = response._rowID,
2037
+ rowTag = response._rowTag,
2038
+ rowLength = response._rowLength,
2039
+ buffer = response._buffer,
2040
+ chunkLength = chunk.length;
2041
+ i < chunkLength;
2034
2042
 
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);
2043
+ ) {
2044
+ var lastIdx = -1;
2045
+ switch (rowState) {
2046
+ case 0:
2047
+ lastIdx = chunk.charCodeAt(i++);
2048
+ 58 === lastIdx
2049
+ ? (rowState = 1)
2050
+ : (rowID =
2051
+ (rowID << 4) |
2052
+ (96 < lastIdx ? lastIdx - 87 : lastIdx - 48));
2053
+ continue;
2054
+ case 1:
2055
+ rowState = chunk.charCodeAt(i);
2056
+ 84 === rowState ||
2057
+ 65 === rowState ||
2058
+ 79 === rowState ||
2059
+ 111 === rowState ||
2060
+ 85 === rowState ||
2061
+ 83 === rowState ||
2062
+ 115 === rowState ||
2063
+ 76 === rowState ||
2064
+ 108 === rowState ||
2065
+ 71 === rowState ||
2066
+ 103 === rowState ||
2067
+ 77 === rowState ||
2068
+ 109 === rowState ||
2069
+ 86 === rowState
2070
+ ? ((rowTag = rowState), (rowState = 2), i++)
2071
+ : (64 < rowState && 91 > rowState) ||
2072
+ 114 === rowState ||
2073
+ 120 === rowState
2074
+ ? ((rowTag = rowState), (rowState = 3), i++)
2075
+ : ((rowTag = 0), (rowState = 3));
2076
+ continue;
2077
+ case 2:
2078
+ lastIdx = chunk.charCodeAt(i++);
2079
+ 44 === lastIdx
2080
+ ? (rowState = 4)
2081
+ : (rowLength =
2082
+ (rowLength << 4) |
2083
+ (96 < lastIdx ? lastIdx - 87 : lastIdx - 48));
2084
+ continue;
2085
+ case 3:
2086
+ lastIdx = chunk.indexOf("\n", i);
2087
+ break;
2088
+ case 4:
2089
+ if (84 !== rowTag)
2090
+ throw Error(
2091
+ "Binary RSC chunks cannot be encoded as strings. This is a bug in the wiring of the React streams."
2092
+ );
2093
+ if (rowLength < chunk.length || chunk.length > 3 * rowLength)
2094
+ throw Error(
2095
+ "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."
2096
+ );
2097
+ lastIdx = chunk.length;
2098
+ }
2099
+ if (-1 < lastIdx) {
2100
+ if (0 < buffer.length)
2101
+ throw Error(
2102
+ "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."
2103
+ );
2104
+ i = chunk.slice(i, lastIdx);
2105
+ processFullStringRow(response, rowID, rowTag, i);
2106
+ i = lastIdx;
2107
+ 3 === rowState && i++;
2108
+ rowLength = rowID = rowTag = rowState = 0;
2109
+ buffer.length = 0;
2110
+ } else if (chunk.length !== i)
2111
+ throw Error(
2112
+ "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."
2113
+ );
2083
2114
  }
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;
2115
+ response._rowState = rowState;
2116
+ response._rowID = rowID;
2117
+ response._rowTag = rowTag;
2118
+ response._rowLength = rowLength;
2119
+ } else {
2120
+ rowLength = 0;
2121
+ chunkLength = response._rowState;
2122
+ rowID = response._rowID;
2123
+ i = response._rowTag;
2124
+ rowState = response._rowLength;
2125
+ buffer = response._buffer;
2126
+ for (rowTag = chunk.length; rowLength < rowTag; ) {
2127
+ lastIdx = -1;
2128
+ switch (chunkLength) {
2129
+ case 0:
2130
+ lastIdx = chunk[rowLength++];
2131
+ 58 === lastIdx
2132
+ ? (chunkLength = 1)
2133
+ : (rowID =
2134
+ (rowID << 4) |
2135
+ (96 < lastIdx ? lastIdx - 87 : lastIdx - 48));
2136
+ continue;
2137
+ case 1:
2138
+ chunkLength = chunk[rowLength];
2139
+ 84 === chunkLength ||
2140
+ 65 === chunkLength ||
2141
+ 79 === chunkLength ||
2142
+ 111 === chunkLength ||
2143
+ 85 === chunkLength ||
2144
+ 83 === chunkLength ||
2145
+ 115 === chunkLength ||
2146
+ 76 === chunkLength ||
2147
+ 108 === chunkLength ||
2148
+ 71 === chunkLength ||
2149
+ 103 === chunkLength ||
2150
+ 77 === chunkLength ||
2151
+ 109 === chunkLength ||
2152
+ 86 === chunkLength
2153
+ ? ((i = chunkLength), (chunkLength = 2), rowLength++)
2154
+ : (64 < chunkLength && 91 > chunkLength) ||
2155
+ 114 === chunkLength ||
2156
+ 120 === chunkLength
2157
+ ? ((i = chunkLength), (chunkLength = 3), rowLength++)
2158
+ : ((i = 0), (chunkLength = 3));
2159
+ continue;
2160
+ case 2:
2161
+ lastIdx = chunk[rowLength++];
2162
+ 44 === lastIdx
2163
+ ? (chunkLength = 4)
2164
+ : (rowState =
2165
+ (rowState << 4) |
2166
+ (96 < lastIdx ? lastIdx - 87 : lastIdx - 48));
2167
+ continue;
2168
+ case 3:
2169
+ lastIdx = chunk.indexOf(10, rowLength);
2170
+ break;
2171
+ case 4:
2172
+ (lastIdx = rowLength + rowState),
2173
+ lastIdx > chunk.length && (lastIdx = -1);
2174
+ }
2175
+ var offset = chunk.byteOffset + rowLength;
2176
+ if (-1 < lastIdx)
2177
+ (rowState = new Uint8Array(
2178
+ chunk.buffer,
2179
+ offset,
2180
+ lastIdx - rowLength
2181
+ )),
2182
+ processFullBinaryRow(response, rowID, i, buffer, rowState),
2183
+ (rowLength = lastIdx),
2184
+ 3 === chunkLength && rowLength++,
2185
+ (rowState = rowID = i = chunkLength = 0),
2186
+ (buffer.length = 0);
2187
+ else {
2188
+ chunk = new Uint8Array(
2189
+ chunk.buffer,
2190
+ offset,
2191
+ chunk.byteLength - rowLength
2192
+ );
2193
+ buffer.push(chunk);
2194
+ rowState -= chunk.byteLength;
2195
+ break;
2196
+ }
2097
2197
  }
2198
+ response._rowState = chunkLength;
2199
+ response._rowID = rowID;
2200
+ response._rowTag = i;
2201
+ response._rowLength = rowState;
2098
2202
  }
2099
- response._rowState = rowState;
2100
- response._rowID = rowID;
2101
- response._rowTag = rowTag;
2102
- response._rowLength = rowLength;
2103
2203
  });
2104
2204
  stream.on("error", function (error) {
2105
2205
  reportGlobalError(response, error);