react-server-dom-webpack 19.2.0-canary-5d87cd22-20250704 → 19.2.0-canary-befc1246-20250708

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.
@@ -842,7 +842,7 @@
842
842
  "\n//# sourceURL=rsc://React/" +
843
843
  encodeURIComponent(environmentName) +
844
844
  "/" +
845
- filename +
845
+ encodeURI(filename) +
846
846
  "?s" +
847
847
  fakeServerFunctionIdx++),
848
848
  (col += "\n//# sourceMappingURL=" + sourceMap))
@@ -1088,6 +1088,17 @@
1088
1088
  this.reason = reason;
1089
1089
  this._debugInfo = null;
1090
1090
  }
1091
+ function unwrapWeakResponse(weakResponse) {
1092
+ weakResponse = weakResponse.weak.deref();
1093
+ if (void 0 === weakResponse)
1094
+ throw Error(
1095
+ "We did not expect to receive new data after GC:ing the response."
1096
+ );
1097
+ return weakResponse;
1098
+ }
1099
+ function cleanupDebugChannel(debugChannel) {
1100
+ debugChannel("");
1101
+ }
1091
1102
  function readChunk(chunk) {
1092
1103
  switch (chunk.status) {
1093
1104
  case "resolved_model":
@@ -1107,9 +1118,27 @@
1107
1118
  throw chunk.reason;
1108
1119
  }
1109
1120
  }
1110
- function createPendingChunk() {
1121
+ function getRoot(weakResponse) {
1122
+ weakResponse = unwrapWeakResponse(weakResponse);
1123
+ return getChunk(weakResponse, 0);
1124
+ }
1125
+ function createPendingChunk(response) {
1126
+ 0 === response._pendingChunks++ &&
1127
+ ((response._weakResponse.response = response),
1128
+ null !== response._pendingInitialRender &&
1129
+ (clearTimeout(response._pendingInitialRender),
1130
+ (response._pendingInitialRender = null)));
1111
1131
  return new ReactPromise("pending", null, null);
1112
1132
  }
1133
+ function releasePendingChunk(response, chunk) {
1134
+ "pending" === chunk.status &&
1135
+ 0 === --response._pendingChunks &&
1136
+ ((response._weakResponse.response = null),
1137
+ (response._pendingInitialRender = setTimeout(
1138
+ flushInitialRenderPerformance.bind(null, response),
1139
+ 100
1140
+ )));
1141
+ }
1113
1142
  function wakeChunk(listeners, value) {
1114
1143
  for (var i = 0; i < listeners.length; i++) {
1115
1144
  var listener = listeners[i];
@@ -1185,15 +1214,14 @@
1185
1214
  rejectListeners && rejectChunk(rejectListeners, chunk.reason);
1186
1215
  }
1187
1216
  }
1188
- function triggerErrorOnChunk(chunk, error) {
1189
- if ("pending" !== chunk.status && "blocked" !== chunk.status)
1190
- chunk.reason.error(error);
1191
- else {
1192
- var listeners = chunk.reason;
1193
- chunk.status = "rejected";
1194
- chunk.reason = error;
1195
- null !== listeners && rejectChunk(listeners, error);
1196
- }
1217
+ function triggerErrorOnChunk(response, chunk, error) {
1218
+ "pending" !== chunk.status && "blocked" !== chunk.status
1219
+ ? chunk.reason.error(error)
1220
+ : (releasePendingChunk(response, chunk),
1221
+ (response = chunk.reason),
1222
+ (chunk.status = "rejected"),
1223
+ (chunk.reason = error),
1224
+ null !== response && rejectChunk(response, error));
1197
1225
  }
1198
1226
  function createResolvedIteratorResultChunk(response, value, done) {
1199
1227
  return new ReactPromise(
@@ -1216,6 +1244,7 @@
1216
1244
  function resolveModelChunk(response, chunk, value) {
1217
1245
  if ("pending" !== chunk.status) chunk.reason.enqueueModel(value);
1218
1246
  else {
1247
+ releasePendingChunk(response, chunk);
1219
1248
  var resolveListeners = chunk.value,
1220
1249
  rejectListeners = chunk.reason;
1221
1250
  chunk.status = "resolved_model";
@@ -1226,15 +1255,16 @@
1226
1255
  wakeChunkIfInitialized(chunk, resolveListeners, rejectListeners));
1227
1256
  }
1228
1257
  }
1229
- function resolveModuleChunk(chunk, value) {
1258
+ function resolveModuleChunk(response, chunk, value) {
1230
1259
  if ("pending" === chunk.status || "blocked" === chunk.status) {
1231
- var resolveListeners = chunk.value,
1232
- rejectListeners = chunk.reason;
1260
+ releasePendingChunk(response, chunk);
1261
+ response = chunk.value;
1262
+ var rejectListeners = chunk.reason;
1233
1263
  chunk.status = "resolved_module";
1234
1264
  chunk.value = value;
1235
- null !== resolveListeners &&
1265
+ null !== response &&
1236
1266
  (initializeModuleChunk(chunk),
1237
- wakeChunkIfInitialized(chunk, resolveListeners, rejectListeners));
1267
+ wakeChunkIfInitialized(chunk, response, rejectListeners));
1238
1268
  }
1239
1269
  }
1240
1270
  function initializeModelChunk(chunk) {
@@ -1277,15 +1307,19 @@
1277
1307
  (chunk.status = "rejected"), (chunk.reason = error);
1278
1308
  }
1279
1309
  }
1280
- function reportGlobalError(response, error) {
1281
- response._closed = !0;
1282
- response._closedReason = error;
1283
- response._chunks.forEach(function (chunk) {
1284
- "pending" === chunk.status && triggerErrorOnChunk(chunk, error);
1285
- });
1286
- var debugChannel = response._debugChannel;
1287
- void 0 !== debugChannel &&
1288
- (debugChannel(""), (response._debugChannel = void 0));
1310
+ function reportGlobalError(weakResponse, error) {
1311
+ if (void 0 !== weakResponse.weak.deref()) {
1312
+ var response = unwrapWeakResponse(weakResponse);
1313
+ response._closed = !0;
1314
+ response._closedReason = error;
1315
+ response._chunks.forEach(function (chunk) {
1316
+ "pending" === chunk.status &&
1317
+ triggerErrorOnChunk(response, chunk, error);
1318
+ });
1319
+ weakResponse = response._debugChannel;
1320
+ void 0 !== weakResponse &&
1321
+ (weakResponse(""), (response._debugChannel = void 0));
1322
+ }
1289
1323
  }
1290
1324
  function nullRefGetter() {
1291
1325
  return null;
@@ -1361,7 +1395,7 @@
1361
1395
  chunk ||
1362
1396
  ((chunk = response._closed
1363
1397
  ? new ReactPromise("rejected", null, response._closedReason)
1364
- : createPendingChunk()),
1398
+ : createPendingChunk(response)),
1365
1399
  chunks.set(id, chunk));
1366
1400
  return chunk;
1367
1401
  }
@@ -1447,31 +1481,31 @@
1447
1481
  }
1448
1482
  function rejectReference(reference, error) {
1449
1483
  var handler = reference.handler;
1450
- if (
1451
- !handler.errored &&
1452
- ((reference = handler.value),
1453
- (handler.errored = !0),
1454
- (handler.value = error),
1455
- (handler = handler.chunk),
1456
- null !== handler && "blocked" === handler.status)
1457
- ) {
1458
- if (
1459
- "object" === typeof reference &&
1460
- null !== reference &&
1461
- reference.$$typeof === REACT_ELEMENT_TYPE
1462
- ) {
1463
- var erroredComponent = {
1464
- name: getComponentNameFromType(reference.type) || "",
1465
- owner: reference._owner
1466
- };
1467
- erroredComponent.debugStack = reference._debugStack;
1468
- supportsCreateTask &&
1469
- (erroredComponent.debugTask = reference._debugTask);
1470
- (handler._debugInfo || (handler._debugInfo = [])).push(
1471
- erroredComponent
1472
- );
1484
+ reference = reference.response;
1485
+ if (!handler.errored) {
1486
+ var blockedValue = handler.value;
1487
+ handler.errored = !0;
1488
+ handler.value = error;
1489
+ handler = handler.chunk;
1490
+ if (null !== handler && "blocked" === handler.status) {
1491
+ if (
1492
+ "object" === typeof blockedValue &&
1493
+ null !== blockedValue &&
1494
+ blockedValue.$$typeof === REACT_ELEMENT_TYPE
1495
+ ) {
1496
+ var erroredComponent = {
1497
+ name: getComponentNameFromType(blockedValue.type) || "",
1498
+ owner: blockedValue._owner
1499
+ };
1500
+ erroredComponent.debugStack = blockedValue._debugStack;
1501
+ supportsCreateTask &&
1502
+ (erroredComponent.debugTask = blockedValue._debugTask);
1503
+ (handler._debugInfo || (handler._debugInfo = [])).push(
1504
+ erroredComponent
1505
+ );
1506
+ }
1507
+ triggerErrorOnChunk(reference, handler, error);
1473
1508
  }
1474
- triggerErrorOnChunk(handler, error);
1475
1509
  }
1476
1510
  }
1477
1511
  function waitForReference(
@@ -1611,7 +1645,7 @@
1611
1645
  erroredComponent
1612
1646
  );
1613
1647
  }
1614
- triggerErrorOnChunk(chunk, error);
1648
+ triggerErrorOnChunk(response, chunk, error);
1615
1649
  }
1616
1650
  }
1617
1651
  }
@@ -1758,6 +1792,23 @@
1758
1792
  function applyConstructor(response, model, parentObject) {
1759
1793
  Object.setPrototypeOf(parentObject, model.prototype);
1760
1794
  }
1795
+ function defineLazyGetter(response, chunk, parentObject, key) {
1796
+ Object.defineProperty(parentObject, key, {
1797
+ get: function () {
1798
+ "resolved_model" === chunk.status && initializeModelChunk(chunk);
1799
+ switch (chunk.status) {
1800
+ case "fulfilled":
1801
+ return chunk.value;
1802
+ case "rejected":
1803
+ throw chunk.reason;
1804
+ }
1805
+ return "This object has been omitted by React in the console log to avoid sending too much data from the server. Try logging smaller or more specific objects.";
1806
+ },
1807
+ enumerable: !0,
1808
+ configurable: !1
1809
+ });
1810
+ return null;
1811
+ }
1761
1812
  function extractIterator(response, model) {
1762
1813
  return model[Symbol.iterator]();
1763
1814
  }
@@ -1796,15 +1847,13 @@
1796
1847
  case "S":
1797
1848
  return Symbol.for(value.slice(2));
1798
1849
  case "F":
1799
- return (
1800
- (value = value.slice(2)),
1801
- getOutlinedModel(
1802
- response,
1803
- value,
1804
- parentObject,
1805
- key,
1806
- loadServerReference
1807
- )
1850
+ var ref = value.slice(2);
1851
+ return getOutlinedModel(
1852
+ response,
1853
+ ref,
1854
+ parentObject,
1855
+ key,
1856
+ loadServerReference
1808
1857
  );
1809
1858
  case "T":
1810
1859
  parentObject = "$" + value.slice(2);
@@ -1816,36 +1865,30 @@
1816
1865
  return response.get(parentObject);
1817
1866
  case "Q":
1818
1867
  return (
1819
- (value = value.slice(2)),
1820
- getOutlinedModel(response, value, parentObject, key, createMap)
1868
+ (ref = value.slice(2)),
1869
+ getOutlinedModel(response, ref, parentObject, key, createMap)
1821
1870
  );
1822
1871
  case "W":
1823
1872
  return (
1824
- (value = value.slice(2)),
1825
- getOutlinedModel(response, value, parentObject, key, createSet)
1873
+ (ref = value.slice(2)),
1874
+ getOutlinedModel(response, ref, parentObject, key, createSet)
1826
1875
  );
1827
1876
  case "B":
1828
1877
  return (
1829
- (value = value.slice(2)),
1830
- getOutlinedModel(response, value, parentObject, key, createBlob)
1878
+ (ref = value.slice(2)),
1879
+ getOutlinedModel(response, ref, parentObject, key, createBlob)
1831
1880
  );
1832
1881
  case "K":
1833
1882
  return (
1834
- (value = value.slice(2)),
1835
- getOutlinedModel(
1836
- response,
1837
- value,
1838
- parentObject,
1839
- key,
1840
- createFormData
1841
- )
1883
+ (ref = value.slice(2)),
1884
+ getOutlinedModel(response, ref, parentObject, key, createFormData)
1842
1885
  );
1843
1886
  case "Z":
1844
1887
  return (
1845
- (value = value.slice(2)),
1888
+ (ref = value.slice(2)),
1846
1889
  getOutlinedModel(
1847
1890
  response,
1848
- value,
1891
+ ref,
1849
1892
  parentObject,
1850
1893
  key,
1851
1894
  resolveErrorDev
@@ -1853,10 +1896,10 @@
1853
1896
  );
1854
1897
  case "i":
1855
1898
  return (
1856
- (value = value.slice(2)),
1899
+ (ref = value.slice(2)),
1857
1900
  getOutlinedModel(
1858
1901
  response,
1859
- value,
1902
+ ref,
1860
1903
  parentObject,
1861
1904
  key,
1862
1905
  extractIterator
@@ -1876,10 +1919,10 @@
1876
1919
  return BigInt(value.slice(2));
1877
1920
  case "P":
1878
1921
  return (
1879
- (value = value.slice(2)),
1922
+ (ref = value.slice(2)),
1880
1923
  getOutlinedModel(
1881
1924
  response,
1882
- value,
1925
+ ref,
1883
1926
  parentObject,
1884
1927
  key,
1885
1928
  applyConstructor
@@ -1925,23 +1968,27 @@
1925
1968
  return function () {};
1926
1969
  }
1927
1970
  case "Y":
1928
- return (
1929
- 2 < value.length &&
1930
- (response = response._debugChannel) &&
1931
- ((value = value.slice(2)), response("R:" + value)),
1932
- Object.defineProperty(parentObject, key, {
1933
- get: function () {
1934
- return "This object has been omitted by React in the console log to avoid sending too much data from the server. Try logging smaller or more specific objects.";
1935
- },
1936
- enumerable: !0,
1937
- configurable: !1
1938
- }),
1939
- null
1940
- );
1971
+ if (2 < value.length && (ref = response._debugChannel)) {
1972
+ value = value.slice(2);
1973
+ var _id2 = parseInt(value, 16);
1974
+ response._chunks.has(_id2) || ref("Q:" + value);
1975
+ ref = getChunk(response, _id2);
1976
+ return "fulfilled" === ref.status
1977
+ ? ref.value
1978
+ : defineLazyGetter(response, ref, parentObject, key);
1979
+ }
1980
+ Object.defineProperty(parentObject, key, {
1981
+ get: function () {
1982
+ return "This object has been omitted by React in the console log to avoid sending too much data from the server. Try logging smaller or more specific objects.";
1983
+ },
1984
+ enumerable: !0,
1985
+ configurable: !1
1986
+ });
1987
+ return null;
1941
1988
  default:
1942
1989
  return (
1943
- (value = value.slice(1)),
1944
- getOutlinedModel(response, value, parentObject, key, createModel)
1990
+ (ref = value.slice(1)),
1991
+ getOutlinedModel(response, ref, parentObject, key, createModel)
1945
1992
  );
1946
1993
  }
1947
1994
  }
@@ -1980,6 +2027,8 @@
1980
2027
  this._closed = !1;
1981
2028
  this._closedReason = null;
1982
2029
  this._tempRefs = temporaryReferences;
2030
+ this._pendingChunks = 0;
2031
+ this._weakResponse = { weak: new WeakRef(this), response: this };
1983
2032
  this._debugRootOwner = bundlerConfig =
1984
2033
  void 0 === ReactSharedInteralsServer ||
1985
2034
  null === ReactSharedInteralsServer.A
@@ -1996,17 +2045,22 @@
1996
2045
  this._debugChannel = debugChannel;
1997
2046
  this._replayConsole = replayConsole;
1998
2047
  this._rootEnvironmentName = environmentName;
2048
+ debugChannel &&
2049
+ (null === debugChannelRegistry
2050
+ ? (debugChannel(""), (this._debugChannel = void 0))
2051
+ : debugChannelRegistry.register(this, debugChannel));
1999
2052
  this._fromJSON = createFromJSONCallback(this);
2000
2053
  }
2001
2054
  function resolveDebugHalt(response, id) {
2002
- response = response._chunks;
2003
- var chunk = response.get(id);
2004
- chunk || response.set(id, (chunk = createPendingChunk()));
2055
+ var chunks = response._chunks,
2056
+ chunk = chunks.get(id);
2057
+ chunk || chunks.set(id, (chunk = createPendingChunk(response)));
2005
2058
  if ("pending" === chunk.status || "blocked" === chunk.status)
2006
- (id = chunk),
2007
- (id.status = "halted"),
2008
- (id.value = null),
2009
- (id.reason = null);
2059
+ releasePendingChunk(response, chunk),
2060
+ (response = chunk),
2061
+ (response.status = "halted"),
2062
+ (response.value = null),
2063
+ (response.reason = null);
2010
2064
  }
2011
2065
  function resolveModel(response, id, model) {
2012
2066
  var chunks = response._chunks,
@@ -2016,18 +2070,20 @@
2016
2070
  : chunks.set(id, new ReactPromise("resolved_model", model, response));
2017
2071
  }
2018
2072
  function resolveText(response, id, text) {
2019
- response = response._chunks;
2020
- var chunk = response.get(id);
2073
+ var chunks = response._chunks,
2074
+ chunk = chunks.get(id);
2021
2075
  chunk && "pending" !== chunk.status
2022
2076
  ? chunk.reason.enqueueValue(text)
2023
- : response.set(id, new ReactPromise("fulfilled", text, null));
2077
+ : (chunk && releasePendingChunk(response, chunk),
2078
+ chunks.set(id, new ReactPromise("fulfilled", text, null)));
2024
2079
  }
2025
2080
  function resolveBuffer(response, id, buffer) {
2026
- response = response._chunks;
2027
- var chunk = response.get(id);
2081
+ var chunks = response._chunks,
2082
+ chunk = chunks.get(id);
2028
2083
  chunk && "pending" !== chunk.status
2029
2084
  ? chunk.reason.enqueueValue(buffer)
2030
- : response.set(id, new ReactPromise("fulfilled", buffer, null));
2085
+ : (chunk && releasePendingChunk(response, chunk),
2086
+ chunks.set(id, new ReactPromise("fulfilled", buffer, null)));
2031
2087
  }
2032
2088
  function resolveModule(response, id, model) {
2033
2089
  var chunks = response._chunks,
@@ -2042,39 +2098,41 @@
2042
2098
  model[1],
2043
2099
  response._nonce
2044
2100
  );
2045
- if ((response = preloadModule(clientReference))) {
2101
+ if ((model = preloadModule(clientReference))) {
2046
2102
  if (chunk) {
2103
+ releasePendingChunk(response, chunk);
2047
2104
  var blockedChunk = chunk;
2048
2105
  blockedChunk.status = "blocked";
2049
2106
  } else
2050
2107
  (blockedChunk = new ReactPromise("blocked", null, null)),
2051
2108
  chunks.set(id, blockedChunk);
2052
- response.then(
2109
+ model.then(
2053
2110
  function () {
2054
- return resolveModuleChunk(blockedChunk, clientReference);
2111
+ return resolveModuleChunk(response, blockedChunk, clientReference);
2055
2112
  },
2056
2113
  function (error) {
2057
- return triggerErrorOnChunk(blockedChunk, error);
2114
+ return triggerErrorOnChunk(response, blockedChunk, error);
2058
2115
  }
2059
2116
  );
2060
2117
  } else
2061
2118
  chunk
2062
- ? resolveModuleChunk(chunk, clientReference)
2119
+ ? resolveModuleChunk(response, chunk, clientReference)
2063
2120
  : chunks.set(
2064
2121
  id,
2065
2122
  new ReactPromise("resolved_module", clientReference, null)
2066
2123
  );
2067
2124
  }
2068
2125
  function resolveStream(response, id, stream, controller) {
2069
- var chunks = response._chunks;
2070
- response = chunks.get(id);
2071
- response
2072
- ? "pending" === response.status &&
2073
- ((id = response.value),
2074
- (response.status = "fulfilled"),
2075
- (response.value = stream),
2076
- (response.reason = controller),
2077
- null !== id && wakeChunk(id, response.value))
2126
+ var chunks = response._chunks,
2127
+ chunk = chunks.get(id);
2128
+ chunk
2129
+ ? "pending" === chunk.status &&
2130
+ (releasePendingChunk(response, chunk),
2131
+ (response = chunk.value),
2132
+ (chunk.status = "fulfilled"),
2133
+ (chunk.value = stream),
2134
+ (chunk.reason = controller),
2135
+ null !== response && wakeChunk(response, chunk.value))
2078
2136
  : chunks.set(id, new ReactPromise("fulfilled", stream, controller));
2079
2137
  }
2080
2138
  function startReadableStream(response, id, type) {
@@ -2111,8 +2169,8 @@
2111
2169
  (previousBlockedChunk = chunk));
2112
2170
  } else {
2113
2171
  chunk = previousBlockedChunk;
2114
- var _chunk2 = createPendingChunk();
2115
- _chunk2.then(
2172
+ var _chunk3 = createPendingChunk(response);
2173
+ _chunk3.then(
2116
2174
  function (v) {
2117
2175
  return controller.enqueue(v);
2118
2176
  },
@@ -2120,10 +2178,10 @@
2120
2178
  return controller.error(e);
2121
2179
  }
2122
2180
  );
2123
- previousBlockedChunk = _chunk2;
2181
+ previousBlockedChunk = _chunk3;
2124
2182
  chunk.then(function () {
2125
- previousBlockedChunk === _chunk2 && (previousBlockedChunk = null);
2126
- resolveModelChunk(response, _chunk2, json);
2183
+ previousBlockedChunk === _chunk3 && (previousBlockedChunk = null);
2184
+ resolveModelChunk(response, _chunk3, json);
2127
2185
  });
2128
2186
  }
2129
2187
  },
@@ -2176,7 +2234,7 @@
2176
2234
  { done: !0, value: void 0 },
2177
2235
  null
2178
2236
  );
2179
- buffer[nextReadIndex] = createPendingChunk();
2237
+ buffer[nextReadIndex] = createPendingChunk(response);
2180
2238
  }
2181
2239
  return buffer[nextReadIndex++];
2182
2240
  });
@@ -2249,11 +2307,11 @@
2249
2307
  closed = !0;
2250
2308
  for (
2251
2309
  nextWriteIndex === buffer.length &&
2252
- (buffer[nextWriteIndex] = createPendingChunk());
2310
+ (buffer[nextWriteIndex] = createPendingChunk(response));
2253
2311
  nextWriteIndex < buffer.length;
2254
2312
 
2255
2313
  )
2256
- triggerErrorOnChunk(buffer[nextWriteIndex++], error);
2314
+ triggerErrorOnChunk(response, buffer[nextWriteIndex++], error);
2257
2315
  }
2258
2316
  }
2259
2317
  );
@@ -2658,6 +2716,7 @@
2658
2716
  );
2659
2717
  resolveBuffer(response, id, constructor);
2660
2718
  }
2719
+ function flushInitialRenderPerformance() {}
2661
2720
  function processFullBinaryRow(response, id, tag, buffer, chunk) {
2662
2721
  switch (tag) {
2663
2722
  case 65:
@@ -2728,7 +2787,7 @@
2728
2787
  row = response._chunks;
2729
2788
  var chunk = row.get(id);
2730
2789
  chunk
2731
- ? triggerErrorOnChunk(chunk, tag)
2790
+ ? triggerErrorOnChunk(response, chunk, tag)
2732
2791
  : row.set(id, new ReactPromise("rejected", null, tag));
2733
2792
  break;
2734
2793
  case 84:
@@ -2772,84 +2831,95 @@
2772
2831
  : resolveModel(response, id, row);
2773
2832
  }
2774
2833
  }
2775
- function processBinaryChunk(response, chunk) {
2776
- for (
2777
- var i = 0,
2778
- rowState = response._rowState,
2779
- rowID = response._rowID,
2780
- rowTag = response._rowTag,
2781
- rowLength = response._rowLength,
2782
- buffer = response._buffer,
2783
- chunkLength = chunk.length;
2784
- i < chunkLength;
2834
+ function processBinaryChunk(weakResponse, chunk) {
2835
+ if (void 0 !== weakResponse.weak.deref()) {
2836
+ weakResponse = unwrapWeakResponse(weakResponse);
2837
+ for (
2838
+ var i = 0,
2839
+ rowState = weakResponse._rowState,
2840
+ rowID = weakResponse._rowID,
2841
+ rowTag = weakResponse._rowTag,
2842
+ rowLength = weakResponse._rowLength,
2843
+ buffer = weakResponse._buffer,
2844
+ chunkLength = chunk.length;
2845
+ i < chunkLength;
2785
2846
 
2786
- ) {
2787
- var lastIdx = -1;
2788
- switch (rowState) {
2789
- case 0:
2790
- lastIdx = chunk[i++];
2791
- 58 === lastIdx
2792
- ? (rowState = 1)
2793
- : (rowID =
2794
- (rowID << 4) | (96 < lastIdx ? lastIdx - 87 : lastIdx - 48));
2795
- continue;
2796
- case 1:
2797
- rowState = chunk[i];
2798
- 84 === rowState ||
2799
- 65 === rowState ||
2800
- 79 === rowState ||
2801
- 111 === rowState ||
2802
- 85 === rowState ||
2803
- 83 === rowState ||
2804
- 115 === rowState ||
2805
- 76 === rowState ||
2806
- 108 === rowState ||
2807
- 71 === rowState ||
2808
- 103 === rowState ||
2809
- 77 === rowState ||
2810
- 109 === rowState ||
2811
- 86 === rowState
2812
- ? ((rowTag = rowState), (rowState = 2), i++)
2813
- : (64 < rowState && 91 > rowState) ||
2814
- 35 === rowState ||
2815
- 114 === rowState ||
2816
- 120 === rowState
2817
- ? ((rowTag = rowState), (rowState = 3), i++)
2818
- : ((rowTag = 0), (rowState = 3));
2819
- continue;
2820
- case 2:
2821
- lastIdx = chunk[i++];
2822
- 44 === lastIdx
2823
- ? (rowState = 4)
2824
- : (rowLength =
2825
- (rowLength << 4) |
2826
- (96 < lastIdx ? lastIdx - 87 : lastIdx - 48));
2827
- continue;
2828
- case 3:
2829
- lastIdx = chunk.indexOf(10, i);
2847
+ ) {
2848
+ var lastIdx = -1;
2849
+ switch (rowState) {
2850
+ case 0:
2851
+ lastIdx = chunk[i++];
2852
+ 58 === lastIdx
2853
+ ? (rowState = 1)
2854
+ : (rowID =
2855
+ (rowID << 4) |
2856
+ (96 < lastIdx ? lastIdx - 87 : lastIdx - 48));
2857
+ continue;
2858
+ case 1:
2859
+ rowState = chunk[i];
2860
+ 84 === rowState ||
2861
+ 65 === rowState ||
2862
+ 79 === rowState ||
2863
+ 111 === rowState ||
2864
+ 85 === rowState ||
2865
+ 83 === rowState ||
2866
+ 115 === rowState ||
2867
+ 76 === rowState ||
2868
+ 108 === rowState ||
2869
+ 71 === rowState ||
2870
+ 103 === rowState ||
2871
+ 77 === rowState ||
2872
+ 109 === rowState ||
2873
+ 86 === rowState
2874
+ ? ((rowTag = rowState), (rowState = 2), i++)
2875
+ : (64 < rowState && 91 > rowState) ||
2876
+ 35 === rowState ||
2877
+ 114 === rowState ||
2878
+ 120 === rowState
2879
+ ? ((rowTag = rowState), (rowState = 3), i++)
2880
+ : ((rowTag = 0), (rowState = 3));
2881
+ continue;
2882
+ case 2:
2883
+ lastIdx = chunk[i++];
2884
+ 44 === lastIdx
2885
+ ? (rowState = 4)
2886
+ : (rowLength =
2887
+ (rowLength << 4) |
2888
+ (96 < lastIdx ? lastIdx - 87 : lastIdx - 48));
2889
+ continue;
2890
+ case 3:
2891
+ lastIdx = chunk.indexOf(10, i);
2892
+ break;
2893
+ case 4:
2894
+ (lastIdx = i + rowLength),
2895
+ lastIdx > chunk.length && (lastIdx = -1);
2896
+ }
2897
+ var offset = chunk.byteOffset + i;
2898
+ if (-1 < lastIdx)
2899
+ (rowLength = new Uint8Array(chunk.buffer, offset, lastIdx - i)),
2900
+ processFullBinaryRow(
2901
+ weakResponse,
2902
+ rowID,
2903
+ rowTag,
2904
+ buffer,
2905
+ rowLength
2906
+ ),
2907
+ (i = lastIdx),
2908
+ 3 === rowState && i++,
2909
+ (rowLength = rowID = rowTag = rowState = 0),
2910
+ (buffer.length = 0);
2911
+ else {
2912
+ chunk = new Uint8Array(chunk.buffer, offset, chunk.byteLength - i);
2913
+ buffer.push(chunk);
2914
+ rowLength -= chunk.byteLength;
2830
2915
  break;
2831
- case 4:
2832
- (lastIdx = i + rowLength), lastIdx > chunk.length && (lastIdx = -1);
2833
- }
2834
- var offset = chunk.byteOffset + i;
2835
- if (-1 < lastIdx)
2836
- (rowLength = new Uint8Array(chunk.buffer, offset, lastIdx - i)),
2837
- processFullBinaryRow(response, rowID, rowTag, buffer, rowLength),
2838
- (i = lastIdx),
2839
- 3 === rowState && i++,
2840
- (rowLength = rowID = rowTag = rowState = 0),
2841
- (buffer.length = 0);
2842
- else {
2843
- chunk = new Uint8Array(chunk.buffer, offset, chunk.byteLength - i);
2844
- buffer.push(chunk);
2845
- rowLength -= chunk.byteLength;
2846
- break;
2916
+ }
2847
2917
  }
2918
+ weakResponse._rowState = rowState;
2919
+ weakResponse._rowID = rowID;
2920
+ weakResponse._rowTag = rowTag;
2921
+ weakResponse._rowLength = rowLength;
2848
2922
  }
2849
- response._rowState = rowState;
2850
- response._rowID = rowID;
2851
- response._rowTag = rowTag;
2852
- response._rowLength = rowLength;
2853
2923
  }
2854
2924
  function createFromJSONCallback(response) {
2855
2925
  return function (key, value) {
@@ -2931,8 +3001,8 @@
2931
3001
  return value;
2932
3002
  };
2933
3003
  }
2934
- function close(response) {
2935
- reportGlobalError(response, Error("Connection closed."));
3004
+ function close(weakResponse) {
3005
+ reportGlobalError(weakResponse, Error("Connection closed."));
2936
3006
  }
2937
3007
  function noServerCall$1() {
2938
3008
  throw Error(
@@ -2954,7 +3024,7 @@
2954
3024
  options ? !0 === options.replayConsoleLogs : !1,
2955
3025
  options && options.environmentName ? options.environmentName : void 0,
2956
3026
  void 0
2957
- );
3027
+ )._weakResponse;
2958
3028
  }
2959
3029
  function startReadingFromStream(response, stream) {
2960
3030
  function progress(_ref) {
@@ -3051,7 +3121,11 @@
3051
3121
  "function" === typeof reject && reject(this.reason);
3052
3122
  }
3053
3123
  };
3054
- var initializingHandler = null,
3124
+ var debugChannelRegistry =
3125
+ "function" === typeof FinalizationRegistry
3126
+ ? new FinalizationRegistry(cleanupDebugChannel)
3127
+ : null,
3128
+ initializingHandler = null,
3055
3129
  supportsCreateTask = !!console.createTask,
3056
3130
  fakeFunctionCache = new Map(),
3057
3131
  fakeFunctionIdx = 0,
@@ -3160,14 +3234,14 @@
3160
3234
  reportGlobalError(response, e);
3161
3235
  }
3162
3236
  );
3163
- return getChunk(response, 0);
3237
+ return getRoot(response);
3164
3238
  };
3165
3239
  exports.createFromNodeStream = function (
3166
3240
  stream,
3167
3241
  serverConsumerManifest,
3168
3242
  options
3169
3243
  ) {
3170
- var response = new ResponseInstance(
3244
+ var response$jscomp$0 = new ResponseInstance(
3171
3245
  serverConsumerManifest.moduleMap,
3172
3246
  serverConsumerManifest.serverModuleMap,
3173
3247
  serverConsumerManifest.moduleLoading,
@@ -3179,109 +3253,112 @@
3179
3253
  options ? !0 === options.replayConsoleLogs : !1,
3180
3254
  options && options.environmentName ? options.environmentName : void 0,
3181
3255
  void 0
3182
- );
3256
+ )._weakResponse;
3183
3257
  stream.on("data", function (chunk) {
3184
3258
  if ("string" === typeof chunk) {
3185
- for (
3186
- var i = 0,
3187
- rowState = response._rowState,
3188
- rowID = response._rowID,
3189
- rowTag = response._rowTag,
3190
- rowLength = response._rowLength,
3191
- buffer = response._buffer,
3192
- chunkLength = chunk.length;
3193
- i < chunkLength;
3259
+ if (void 0 !== response$jscomp$0.weak.deref()) {
3260
+ for (
3261
+ var response = unwrapWeakResponse(response$jscomp$0),
3262
+ i = 0,
3263
+ rowState = response._rowState,
3264
+ rowID = response._rowID,
3265
+ rowTag = response._rowTag,
3266
+ rowLength = response._rowLength,
3267
+ buffer = response._buffer,
3268
+ chunkLength = chunk.length;
3269
+ i < chunkLength;
3194
3270
 
3195
- ) {
3196
- var lastIdx = -1;
3197
- switch (rowState) {
3198
- case 0:
3199
- lastIdx = chunk.charCodeAt(i++);
3200
- 58 === lastIdx
3201
- ? (rowState = 1)
3202
- : (rowID =
3203
- (rowID << 4) |
3204
- (96 < lastIdx ? lastIdx - 87 : lastIdx - 48));
3205
- continue;
3206
- case 1:
3207
- rowState = chunk.charCodeAt(i);
3208
- 84 === rowState ||
3209
- 65 === rowState ||
3210
- 79 === rowState ||
3211
- 111 === rowState ||
3212
- 85 === rowState ||
3213
- 83 === rowState ||
3214
- 115 === rowState ||
3215
- 76 === rowState ||
3216
- 108 === rowState ||
3217
- 71 === rowState ||
3218
- 103 === rowState ||
3219
- 77 === rowState ||
3220
- 109 === rowState ||
3221
- 86 === rowState
3222
- ? ((rowTag = rowState), (rowState = 2), i++)
3223
- : (64 < rowState && 91 > rowState) ||
3224
- 114 === rowState ||
3225
- 120 === rowState
3226
- ? ((rowTag = rowState), (rowState = 3), i++)
3227
- : ((rowTag = 0), (rowState = 3));
3228
- continue;
3229
- case 2:
3230
- lastIdx = chunk.charCodeAt(i++);
3231
- 44 === lastIdx
3232
- ? (rowState = 4)
3233
- : (rowLength =
3234
- (rowLength << 4) |
3235
- (96 < lastIdx ? lastIdx - 87 : lastIdx - 48));
3236
- continue;
3237
- case 3:
3238
- lastIdx = chunk.indexOf("\n", i);
3239
- break;
3240
- case 4:
3241
- if (84 !== rowTag)
3242
- throw Error(
3243
- "Binary RSC chunks cannot be encoded as strings. This is a bug in the wiring of the React streams."
3244
- );
3245
- if (rowLength < chunk.length || chunk.length > 3 * rowLength)
3271
+ ) {
3272
+ var lastIdx = -1;
3273
+ switch (rowState) {
3274
+ case 0:
3275
+ lastIdx = chunk.charCodeAt(i++);
3276
+ 58 === lastIdx
3277
+ ? (rowState = 1)
3278
+ : (rowID =
3279
+ (rowID << 4) |
3280
+ (96 < lastIdx ? lastIdx - 87 : lastIdx - 48));
3281
+ continue;
3282
+ case 1:
3283
+ rowState = chunk.charCodeAt(i);
3284
+ 84 === rowState ||
3285
+ 65 === rowState ||
3286
+ 79 === rowState ||
3287
+ 111 === rowState ||
3288
+ 85 === rowState ||
3289
+ 83 === rowState ||
3290
+ 115 === rowState ||
3291
+ 76 === rowState ||
3292
+ 108 === rowState ||
3293
+ 71 === rowState ||
3294
+ 103 === rowState ||
3295
+ 77 === rowState ||
3296
+ 109 === rowState ||
3297
+ 86 === rowState
3298
+ ? ((rowTag = rowState), (rowState = 2), i++)
3299
+ : (64 < rowState && 91 > rowState) ||
3300
+ 114 === rowState ||
3301
+ 120 === rowState
3302
+ ? ((rowTag = rowState), (rowState = 3), i++)
3303
+ : ((rowTag = 0), (rowState = 3));
3304
+ continue;
3305
+ case 2:
3306
+ lastIdx = chunk.charCodeAt(i++);
3307
+ 44 === lastIdx
3308
+ ? (rowState = 4)
3309
+ : (rowLength =
3310
+ (rowLength << 4) |
3311
+ (96 < lastIdx ? lastIdx - 87 : lastIdx - 48));
3312
+ continue;
3313
+ case 3:
3314
+ lastIdx = chunk.indexOf("\n", i);
3315
+ break;
3316
+ case 4:
3317
+ if (84 !== rowTag)
3318
+ throw Error(
3319
+ "Binary RSC chunks cannot be encoded as strings. This is a bug in the wiring of the React streams."
3320
+ );
3321
+ if (rowLength < chunk.length || chunk.length > 3 * rowLength)
3322
+ throw Error(
3323
+ "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."
3324
+ );
3325
+ lastIdx = chunk.length;
3326
+ }
3327
+ if (-1 < lastIdx) {
3328
+ if (0 < buffer.length)
3246
3329
  throw Error(
3247
3330
  "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."
3248
3331
  );
3249
- lastIdx = chunk.length;
3250
- }
3251
- if (-1 < lastIdx) {
3252
- if (0 < buffer.length)
3332
+ i = chunk.slice(i, lastIdx);
3333
+ processFullStringRow(response, rowID, rowTag, i);
3334
+ i = lastIdx;
3335
+ 3 === rowState && i++;
3336
+ rowLength = rowID = rowTag = rowState = 0;
3337
+ buffer.length = 0;
3338
+ } else if (chunk.length !== i)
3253
3339
  throw Error(
3254
3340
  "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."
3255
3341
  );
3256
- i = chunk.slice(i, lastIdx);
3257
- processFullStringRow(response, rowID, rowTag, i);
3258
- i = lastIdx;
3259
- 3 === rowState && i++;
3260
- rowLength = rowID = rowTag = rowState = 0;
3261
- buffer.length = 0;
3262
- } else if (chunk.length !== i)
3263
- throw Error(
3264
- "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."
3265
- );
3342
+ }
3343
+ response._rowState = rowState;
3344
+ response._rowID = rowID;
3345
+ response._rowTag = rowTag;
3346
+ response._rowLength = rowLength;
3266
3347
  }
3267
- response._rowState = rowState;
3268
- response._rowID = rowID;
3269
- response._rowTag = rowTag;
3270
- response._rowLength = rowLength;
3271
- } else processBinaryChunk(response, chunk);
3348
+ } else processBinaryChunk(response$jscomp$0, chunk);
3272
3349
  });
3273
3350
  stream.on("error", function (error) {
3274
- reportGlobalError(response, error);
3351
+ reportGlobalError(response$jscomp$0, error);
3275
3352
  });
3276
3353
  stream.on("end", function () {
3277
- return close(response);
3354
+ return close(response$jscomp$0);
3278
3355
  });
3279
- return getChunk(response, 0);
3356
+ return getRoot(response$jscomp$0);
3280
3357
  };
3281
3358
  exports.createFromReadableStream = function (stream, options) {
3282
3359
  options = createResponseFromOptions(options);
3283
3360
  startReadingFromStream(options, stream);
3284
- return getChunk(options, 0);
3361
+ return getRoot(options);
3285
3362
  };
3286
3363
  exports.createServerReference = function (id) {
3287
3364
  return createServerReference$1(id, noServerCall$1);