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.
@@ -880,7 +880,7 @@
880
880
  "\n//# sourceURL=rsc://React/" +
881
881
  encodeURIComponent(environmentName) +
882
882
  "/" +
883
- filename +
883
+ encodeURI(filename) +
884
884
  "?s" +
885
885
  fakeServerFunctionIdx++),
886
886
  (col += "\n//# sourceMappingURL=" + sourceMap))
@@ -1126,6 +1126,17 @@
1126
1126
  this.reason = reason;
1127
1127
  this._debugInfo = null;
1128
1128
  }
1129
+ function unwrapWeakResponse(weakResponse) {
1130
+ weakResponse = weakResponse.weak.deref();
1131
+ if (void 0 === weakResponse)
1132
+ throw Error(
1133
+ "We did not expect to receive new data after GC:ing the response."
1134
+ );
1135
+ return weakResponse;
1136
+ }
1137
+ function cleanupDebugChannel(debugChannel) {
1138
+ debugChannel("");
1139
+ }
1129
1140
  function readChunk(chunk) {
1130
1141
  switch (chunk.status) {
1131
1142
  case "resolved_model":
@@ -1145,9 +1156,27 @@
1145
1156
  throw chunk.reason;
1146
1157
  }
1147
1158
  }
1148
- function createPendingChunk() {
1159
+ function getRoot(weakResponse) {
1160
+ weakResponse = unwrapWeakResponse(weakResponse);
1161
+ return getChunk(weakResponse, 0);
1162
+ }
1163
+ function createPendingChunk(response) {
1164
+ 0 === response._pendingChunks++ &&
1165
+ ((response._weakResponse.response = response),
1166
+ null !== response._pendingInitialRender &&
1167
+ (clearTimeout(response._pendingInitialRender),
1168
+ (response._pendingInitialRender = null)));
1149
1169
  return new ReactPromise("pending", null, null);
1150
1170
  }
1171
+ function releasePendingChunk(response, chunk) {
1172
+ "pending" === chunk.status &&
1173
+ 0 === --response._pendingChunks &&
1174
+ ((response._weakResponse.response = null),
1175
+ (response._pendingInitialRender = setTimeout(
1176
+ flushInitialRenderPerformance.bind(null, response),
1177
+ 100
1178
+ )));
1179
+ }
1151
1180
  function wakeChunk(listeners, value) {
1152
1181
  for (var i = 0; i < listeners.length; i++) {
1153
1182
  var listener = listeners[i];
@@ -1223,15 +1252,14 @@
1223
1252
  rejectListeners && rejectChunk(rejectListeners, chunk.reason);
1224
1253
  }
1225
1254
  }
1226
- function triggerErrorOnChunk(chunk, error) {
1227
- if ("pending" !== chunk.status && "blocked" !== chunk.status)
1228
- chunk.reason.error(error);
1229
- else {
1230
- var listeners = chunk.reason;
1231
- chunk.status = "rejected";
1232
- chunk.reason = error;
1233
- null !== listeners && rejectChunk(listeners, error);
1234
- }
1255
+ function triggerErrorOnChunk(response, chunk, error) {
1256
+ "pending" !== chunk.status && "blocked" !== chunk.status
1257
+ ? chunk.reason.error(error)
1258
+ : (releasePendingChunk(response, chunk),
1259
+ (response = chunk.reason),
1260
+ (chunk.status = "rejected"),
1261
+ (chunk.reason = error),
1262
+ null !== response && rejectChunk(response, error));
1235
1263
  }
1236
1264
  function createResolvedIteratorResultChunk(response, value, done) {
1237
1265
  return new ReactPromise(
@@ -1254,6 +1282,7 @@
1254
1282
  function resolveModelChunk(response, chunk, value) {
1255
1283
  if ("pending" !== chunk.status) chunk.reason.enqueueModel(value);
1256
1284
  else {
1285
+ releasePendingChunk(response, chunk);
1257
1286
  var resolveListeners = chunk.value,
1258
1287
  rejectListeners = chunk.reason;
1259
1288
  chunk.status = "resolved_model";
@@ -1264,15 +1293,16 @@
1264
1293
  wakeChunkIfInitialized(chunk, resolveListeners, rejectListeners));
1265
1294
  }
1266
1295
  }
1267
- function resolveModuleChunk(chunk, value) {
1296
+ function resolveModuleChunk(response, chunk, value) {
1268
1297
  if ("pending" === chunk.status || "blocked" === chunk.status) {
1269
- var resolveListeners = chunk.value,
1270
- rejectListeners = chunk.reason;
1298
+ releasePendingChunk(response, chunk);
1299
+ response = chunk.value;
1300
+ var rejectListeners = chunk.reason;
1271
1301
  chunk.status = "resolved_module";
1272
1302
  chunk.value = value;
1273
- null !== resolveListeners &&
1303
+ null !== response &&
1274
1304
  (initializeModuleChunk(chunk),
1275
- wakeChunkIfInitialized(chunk, resolveListeners, rejectListeners));
1305
+ wakeChunkIfInitialized(chunk, response, rejectListeners));
1276
1306
  }
1277
1307
  }
1278
1308
  function initializeModelChunk(chunk) {
@@ -1315,15 +1345,19 @@
1315
1345
  (chunk.status = "rejected"), (chunk.reason = error);
1316
1346
  }
1317
1347
  }
1318
- function reportGlobalError(response, error) {
1319
- response._closed = !0;
1320
- response._closedReason = error;
1321
- response._chunks.forEach(function (chunk) {
1322
- "pending" === chunk.status && triggerErrorOnChunk(chunk, error);
1323
- });
1324
- var debugChannel = response._debugChannel;
1325
- void 0 !== debugChannel &&
1326
- (debugChannel(""), (response._debugChannel = void 0));
1348
+ function reportGlobalError(weakResponse, error) {
1349
+ if (void 0 !== weakResponse.weak.deref()) {
1350
+ var response = unwrapWeakResponse(weakResponse);
1351
+ response._closed = !0;
1352
+ response._closedReason = error;
1353
+ response._chunks.forEach(function (chunk) {
1354
+ "pending" === chunk.status &&
1355
+ triggerErrorOnChunk(response, chunk, error);
1356
+ });
1357
+ weakResponse = response._debugChannel;
1358
+ void 0 !== weakResponse &&
1359
+ (weakResponse(""), (response._debugChannel = void 0));
1360
+ }
1327
1361
  }
1328
1362
  function nullRefGetter() {
1329
1363
  return null;
@@ -1399,7 +1433,7 @@
1399
1433
  chunk ||
1400
1434
  ((chunk = response._closed
1401
1435
  ? new ReactPromise("rejected", null, response._closedReason)
1402
- : createPendingChunk()),
1436
+ : createPendingChunk(response)),
1403
1437
  chunks.set(id, chunk));
1404
1438
  return chunk;
1405
1439
  }
@@ -1485,31 +1519,31 @@
1485
1519
  }
1486
1520
  function rejectReference(reference, error) {
1487
1521
  var handler = reference.handler;
1488
- if (
1489
- !handler.errored &&
1490
- ((reference = handler.value),
1491
- (handler.errored = !0),
1492
- (handler.value = error),
1493
- (handler = handler.chunk),
1494
- null !== handler && "blocked" === handler.status)
1495
- ) {
1496
- if (
1497
- "object" === typeof reference &&
1498
- null !== reference &&
1499
- reference.$$typeof === REACT_ELEMENT_TYPE
1500
- ) {
1501
- var erroredComponent = {
1502
- name: getComponentNameFromType(reference.type) || "",
1503
- owner: reference._owner
1504
- };
1505
- erroredComponent.debugStack = reference._debugStack;
1506
- supportsCreateTask &&
1507
- (erroredComponent.debugTask = reference._debugTask);
1508
- (handler._debugInfo || (handler._debugInfo = [])).push(
1509
- erroredComponent
1510
- );
1522
+ reference = reference.response;
1523
+ if (!handler.errored) {
1524
+ var blockedValue = handler.value;
1525
+ handler.errored = !0;
1526
+ handler.value = error;
1527
+ handler = handler.chunk;
1528
+ if (null !== handler && "blocked" === handler.status) {
1529
+ if (
1530
+ "object" === typeof blockedValue &&
1531
+ null !== blockedValue &&
1532
+ blockedValue.$$typeof === REACT_ELEMENT_TYPE
1533
+ ) {
1534
+ var erroredComponent = {
1535
+ name: getComponentNameFromType(blockedValue.type) || "",
1536
+ owner: blockedValue._owner
1537
+ };
1538
+ erroredComponent.debugStack = blockedValue._debugStack;
1539
+ supportsCreateTask &&
1540
+ (erroredComponent.debugTask = blockedValue._debugTask);
1541
+ (handler._debugInfo || (handler._debugInfo = [])).push(
1542
+ erroredComponent
1543
+ );
1544
+ }
1545
+ triggerErrorOnChunk(reference, handler, error);
1511
1546
  }
1512
- triggerErrorOnChunk(handler, error);
1513
1547
  }
1514
1548
  }
1515
1549
  function waitForReference(
@@ -1649,7 +1683,7 @@
1649
1683
  erroredComponent
1650
1684
  );
1651
1685
  }
1652
- triggerErrorOnChunk(chunk, error);
1686
+ triggerErrorOnChunk(response, chunk, error);
1653
1687
  }
1654
1688
  }
1655
1689
  }
@@ -1796,6 +1830,23 @@
1796
1830
  function applyConstructor(response, model, parentObject) {
1797
1831
  Object.setPrototypeOf(parentObject, model.prototype);
1798
1832
  }
1833
+ function defineLazyGetter(response, chunk, parentObject, key) {
1834
+ Object.defineProperty(parentObject, key, {
1835
+ get: function () {
1836
+ "resolved_model" === chunk.status && initializeModelChunk(chunk);
1837
+ switch (chunk.status) {
1838
+ case "fulfilled":
1839
+ return chunk.value;
1840
+ case "rejected":
1841
+ throw chunk.reason;
1842
+ }
1843
+ 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.";
1844
+ },
1845
+ enumerable: !0,
1846
+ configurable: !1
1847
+ });
1848
+ return null;
1849
+ }
1799
1850
  function extractIterator(response, model) {
1800
1851
  return model[Symbol.iterator]();
1801
1852
  }
@@ -1834,15 +1885,13 @@
1834
1885
  case "S":
1835
1886
  return Symbol.for(value.slice(2));
1836
1887
  case "F":
1837
- return (
1838
- (value = value.slice(2)),
1839
- getOutlinedModel(
1840
- response,
1841
- value,
1842
- parentObject,
1843
- key,
1844
- loadServerReference
1845
- )
1888
+ var ref = value.slice(2);
1889
+ return getOutlinedModel(
1890
+ response,
1891
+ ref,
1892
+ parentObject,
1893
+ key,
1894
+ loadServerReference
1846
1895
  );
1847
1896
  case "T":
1848
1897
  parentObject = "$" + value.slice(2);
@@ -1854,36 +1903,30 @@
1854
1903
  return response.get(parentObject);
1855
1904
  case "Q":
1856
1905
  return (
1857
- (value = value.slice(2)),
1858
- getOutlinedModel(response, value, parentObject, key, createMap)
1906
+ (ref = value.slice(2)),
1907
+ getOutlinedModel(response, ref, parentObject, key, createMap)
1859
1908
  );
1860
1909
  case "W":
1861
1910
  return (
1862
- (value = value.slice(2)),
1863
- getOutlinedModel(response, value, parentObject, key, createSet)
1911
+ (ref = value.slice(2)),
1912
+ getOutlinedModel(response, ref, parentObject, key, createSet)
1864
1913
  );
1865
1914
  case "B":
1866
1915
  return (
1867
- (value = value.slice(2)),
1868
- getOutlinedModel(response, value, parentObject, key, createBlob)
1916
+ (ref = value.slice(2)),
1917
+ getOutlinedModel(response, ref, parentObject, key, createBlob)
1869
1918
  );
1870
1919
  case "K":
1871
1920
  return (
1872
- (value = value.slice(2)),
1873
- getOutlinedModel(
1874
- response,
1875
- value,
1876
- parentObject,
1877
- key,
1878
- createFormData
1879
- )
1921
+ (ref = value.slice(2)),
1922
+ getOutlinedModel(response, ref, parentObject, key, createFormData)
1880
1923
  );
1881
1924
  case "Z":
1882
1925
  return (
1883
- (value = value.slice(2)),
1926
+ (ref = value.slice(2)),
1884
1927
  getOutlinedModel(
1885
1928
  response,
1886
- value,
1929
+ ref,
1887
1930
  parentObject,
1888
1931
  key,
1889
1932
  resolveErrorDev
@@ -1891,10 +1934,10 @@
1891
1934
  );
1892
1935
  case "i":
1893
1936
  return (
1894
- (value = value.slice(2)),
1937
+ (ref = value.slice(2)),
1895
1938
  getOutlinedModel(
1896
1939
  response,
1897
- value,
1940
+ ref,
1898
1941
  parentObject,
1899
1942
  key,
1900
1943
  extractIterator
@@ -1914,10 +1957,10 @@
1914
1957
  return BigInt(value.slice(2));
1915
1958
  case "P":
1916
1959
  return (
1917
- (value = value.slice(2)),
1960
+ (ref = value.slice(2)),
1918
1961
  getOutlinedModel(
1919
1962
  response,
1920
- value,
1963
+ ref,
1921
1964
  parentObject,
1922
1965
  key,
1923
1966
  applyConstructor
@@ -1963,23 +2006,27 @@
1963
2006
  return function () {};
1964
2007
  }
1965
2008
  case "Y":
1966
- return (
1967
- 2 < value.length &&
1968
- (response = response._debugChannel) &&
1969
- ((value = value.slice(2)), response("R:" + value)),
1970
- Object.defineProperty(parentObject, key, {
1971
- get: function () {
1972
- 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.";
1973
- },
1974
- enumerable: !0,
1975
- configurable: !1
1976
- }),
1977
- null
1978
- );
2009
+ if (2 < value.length && (ref = response._debugChannel)) {
2010
+ value = value.slice(2);
2011
+ var _id2 = parseInt(value, 16);
2012
+ response._chunks.has(_id2) || ref("Q:" + value);
2013
+ ref = getChunk(response, _id2);
2014
+ return "fulfilled" === ref.status
2015
+ ? ref.value
2016
+ : defineLazyGetter(response, ref, parentObject, key);
2017
+ }
2018
+ Object.defineProperty(parentObject, key, {
2019
+ get: function () {
2020
+ 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.";
2021
+ },
2022
+ enumerable: !0,
2023
+ configurable: !1
2024
+ });
2025
+ return null;
1979
2026
  default:
1980
2027
  return (
1981
- (value = value.slice(1)),
1982
- getOutlinedModel(response, value, parentObject, key, createModel)
2028
+ (ref = value.slice(1)),
2029
+ getOutlinedModel(response, ref, parentObject, key, createModel)
1983
2030
  );
1984
2031
  }
1985
2032
  }
@@ -2018,6 +2065,8 @@
2018
2065
  this._closed = !1;
2019
2066
  this._closedReason = null;
2020
2067
  this._tempRefs = temporaryReferences;
2068
+ this._pendingChunks = 0;
2069
+ this._weakResponse = { weak: new WeakRef(this), response: this };
2021
2070
  this._debugRootOwner = bundlerConfig =
2022
2071
  void 0 === ReactSharedInteralsServer ||
2023
2072
  null === ReactSharedInteralsServer.A
@@ -2034,17 +2083,22 @@
2034
2083
  this._debugChannel = debugChannel;
2035
2084
  this._replayConsole = replayConsole;
2036
2085
  this._rootEnvironmentName = environmentName;
2086
+ debugChannel &&
2087
+ (null === debugChannelRegistry
2088
+ ? (debugChannel(""), (this._debugChannel = void 0))
2089
+ : debugChannelRegistry.register(this, debugChannel));
2037
2090
  this._fromJSON = createFromJSONCallback(this);
2038
2091
  }
2039
2092
  function resolveDebugHalt(response, id) {
2040
- response = response._chunks;
2041
- var chunk = response.get(id);
2042
- chunk || response.set(id, (chunk = createPendingChunk()));
2093
+ var chunks = response._chunks,
2094
+ chunk = chunks.get(id);
2095
+ chunk || chunks.set(id, (chunk = createPendingChunk(response)));
2043
2096
  if ("pending" === chunk.status || "blocked" === chunk.status)
2044
- (id = chunk),
2045
- (id.status = "halted"),
2046
- (id.value = null),
2047
- (id.reason = null);
2097
+ releasePendingChunk(response, chunk),
2098
+ (response = chunk),
2099
+ (response.status = "halted"),
2100
+ (response.value = null),
2101
+ (response.reason = null);
2048
2102
  }
2049
2103
  function resolveModel(response, id, model) {
2050
2104
  var chunks = response._chunks,
@@ -2054,18 +2108,20 @@
2054
2108
  : chunks.set(id, new ReactPromise("resolved_model", model, response));
2055
2109
  }
2056
2110
  function resolveText(response, id, text) {
2057
- response = response._chunks;
2058
- var chunk = response.get(id);
2111
+ var chunks = response._chunks,
2112
+ chunk = chunks.get(id);
2059
2113
  chunk && "pending" !== chunk.status
2060
2114
  ? chunk.reason.enqueueValue(text)
2061
- : response.set(id, new ReactPromise("fulfilled", text, null));
2115
+ : (chunk && releasePendingChunk(response, chunk),
2116
+ chunks.set(id, new ReactPromise("fulfilled", text, null)));
2062
2117
  }
2063
2118
  function resolveBuffer(response, id, buffer) {
2064
- response = response._chunks;
2065
- var chunk = response.get(id);
2119
+ var chunks = response._chunks,
2120
+ chunk = chunks.get(id);
2066
2121
  chunk && "pending" !== chunk.status
2067
2122
  ? chunk.reason.enqueueValue(buffer)
2068
- : response.set(id, new ReactPromise("fulfilled", buffer, null));
2123
+ : (chunk && releasePendingChunk(response, chunk),
2124
+ chunks.set(id, new ReactPromise("fulfilled", buffer, null)));
2069
2125
  }
2070
2126
  function resolveModule(response, id, model) {
2071
2127
  var chunks = response._chunks,
@@ -2080,39 +2136,41 @@
2080
2136
  model[1],
2081
2137
  response._nonce
2082
2138
  );
2083
- if ((response = preloadModule(clientReference))) {
2139
+ if ((model = preloadModule(clientReference))) {
2084
2140
  if (chunk) {
2141
+ releasePendingChunk(response, chunk);
2085
2142
  var blockedChunk = chunk;
2086
2143
  blockedChunk.status = "blocked";
2087
2144
  } else
2088
2145
  (blockedChunk = new ReactPromise("blocked", null, null)),
2089
2146
  chunks.set(id, blockedChunk);
2090
- response.then(
2147
+ model.then(
2091
2148
  function () {
2092
- return resolveModuleChunk(blockedChunk, clientReference);
2149
+ return resolveModuleChunk(response, blockedChunk, clientReference);
2093
2150
  },
2094
2151
  function (error) {
2095
- return triggerErrorOnChunk(blockedChunk, error);
2152
+ return triggerErrorOnChunk(response, blockedChunk, error);
2096
2153
  }
2097
2154
  );
2098
2155
  } else
2099
2156
  chunk
2100
- ? resolveModuleChunk(chunk, clientReference)
2157
+ ? resolveModuleChunk(response, chunk, clientReference)
2101
2158
  : chunks.set(
2102
2159
  id,
2103
2160
  new ReactPromise("resolved_module", clientReference, null)
2104
2161
  );
2105
2162
  }
2106
2163
  function resolveStream(response, id, stream, controller) {
2107
- var chunks = response._chunks;
2108
- response = chunks.get(id);
2109
- response
2110
- ? "pending" === response.status &&
2111
- ((id = response.value),
2112
- (response.status = "fulfilled"),
2113
- (response.value = stream),
2114
- (response.reason = controller),
2115
- null !== id && wakeChunk(id, response.value))
2164
+ var chunks = response._chunks,
2165
+ chunk = chunks.get(id);
2166
+ chunk
2167
+ ? "pending" === chunk.status &&
2168
+ (releasePendingChunk(response, chunk),
2169
+ (response = chunk.value),
2170
+ (chunk.status = "fulfilled"),
2171
+ (chunk.value = stream),
2172
+ (chunk.reason = controller),
2173
+ null !== response && wakeChunk(response, chunk.value))
2116
2174
  : chunks.set(id, new ReactPromise("fulfilled", stream, controller));
2117
2175
  }
2118
2176
  function startReadableStream(response, id, type) {
@@ -2149,8 +2207,8 @@
2149
2207
  (previousBlockedChunk = chunk));
2150
2208
  } else {
2151
2209
  chunk = previousBlockedChunk;
2152
- var _chunk2 = createPendingChunk();
2153
- _chunk2.then(
2210
+ var _chunk3 = createPendingChunk(response);
2211
+ _chunk3.then(
2154
2212
  function (v) {
2155
2213
  return controller.enqueue(v);
2156
2214
  },
@@ -2158,10 +2216,10 @@
2158
2216
  return controller.error(e);
2159
2217
  }
2160
2218
  );
2161
- previousBlockedChunk = _chunk2;
2219
+ previousBlockedChunk = _chunk3;
2162
2220
  chunk.then(function () {
2163
- previousBlockedChunk === _chunk2 && (previousBlockedChunk = null);
2164
- resolveModelChunk(response, _chunk2, json);
2221
+ previousBlockedChunk === _chunk3 && (previousBlockedChunk = null);
2222
+ resolveModelChunk(response, _chunk3, json);
2165
2223
  });
2166
2224
  }
2167
2225
  },
@@ -2214,7 +2272,7 @@
2214
2272
  { done: !0, value: void 0 },
2215
2273
  null
2216
2274
  );
2217
- buffer[nextReadIndex] = createPendingChunk();
2275
+ buffer[nextReadIndex] = createPendingChunk(response);
2218
2276
  }
2219
2277
  return buffer[nextReadIndex++];
2220
2278
  });
@@ -2287,11 +2345,11 @@
2287
2345
  closed = !0;
2288
2346
  for (
2289
2347
  nextWriteIndex === buffer.length &&
2290
- (buffer[nextWriteIndex] = createPendingChunk());
2348
+ (buffer[nextWriteIndex] = createPendingChunk(response));
2291
2349
  nextWriteIndex < buffer.length;
2292
2350
 
2293
2351
  )
2294
- triggerErrorOnChunk(buffer[nextWriteIndex++], error);
2352
+ triggerErrorOnChunk(response, buffer[nextWriteIndex++], error);
2295
2353
  }
2296
2354
  }
2297
2355
  );
@@ -2696,6 +2754,7 @@
2696
2754
  );
2697
2755
  resolveBuffer(response, id, constructor);
2698
2756
  }
2757
+ function flushInitialRenderPerformance() {}
2699
2758
  function processFullBinaryRow(response, id, tag, buffer, chunk) {
2700
2759
  switch (tag) {
2701
2760
  case 65:
@@ -2766,7 +2825,7 @@
2766
2825
  row = response._chunks;
2767
2826
  var chunk = row.get(id);
2768
2827
  chunk
2769
- ? triggerErrorOnChunk(chunk, tag)
2828
+ ? triggerErrorOnChunk(response, chunk, tag)
2770
2829
  : row.set(id, new ReactPromise("rejected", null, tag));
2771
2830
  break;
2772
2831
  case 84:
@@ -2810,84 +2869,95 @@
2810
2869
  : resolveModel(response, id, row);
2811
2870
  }
2812
2871
  }
2813
- function processBinaryChunk(response, chunk) {
2814
- for (
2815
- var i = 0,
2816
- rowState = response._rowState,
2817
- rowID = response._rowID,
2818
- rowTag = response._rowTag,
2819
- rowLength = response._rowLength,
2820
- buffer = response._buffer,
2821
- chunkLength = chunk.length;
2822
- i < chunkLength;
2872
+ function processBinaryChunk(weakResponse, chunk) {
2873
+ if (void 0 !== weakResponse.weak.deref()) {
2874
+ weakResponse = unwrapWeakResponse(weakResponse);
2875
+ for (
2876
+ var i = 0,
2877
+ rowState = weakResponse._rowState,
2878
+ rowID = weakResponse._rowID,
2879
+ rowTag = weakResponse._rowTag,
2880
+ rowLength = weakResponse._rowLength,
2881
+ buffer = weakResponse._buffer,
2882
+ chunkLength = chunk.length;
2883
+ i < chunkLength;
2823
2884
 
2824
- ) {
2825
- var lastIdx = -1;
2826
- switch (rowState) {
2827
- case 0:
2828
- lastIdx = chunk[i++];
2829
- 58 === lastIdx
2830
- ? (rowState = 1)
2831
- : (rowID =
2832
- (rowID << 4) | (96 < lastIdx ? lastIdx - 87 : lastIdx - 48));
2833
- continue;
2834
- case 1:
2835
- rowState = chunk[i];
2836
- 84 === rowState ||
2837
- 65 === rowState ||
2838
- 79 === rowState ||
2839
- 111 === rowState ||
2840
- 85 === rowState ||
2841
- 83 === rowState ||
2842
- 115 === rowState ||
2843
- 76 === rowState ||
2844
- 108 === rowState ||
2845
- 71 === rowState ||
2846
- 103 === rowState ||
2847
- 77 === rowState ||
2848
- 109 === rowState ||
2849
- 86 === rowState
2850
- ? ((rowTag = rowState), (rowState = 2), i++)
2851
- : (64 < rowState && 91 > rowState) ||
2852
- 35 === rowState ||
2853
- 114 === rowState ||
2854
- 120 === rowState
2855
- ? ((rowTag = rowState), (rowState = 3), i++)
2856
- : ((rowTag = 0), (rowState = 3));
2857
- continue;
2858
- case 2:
2859
- lastIdx = chunk[i++];
2860
- 44 === lastIdx
2861
- ? (rowState = 4)
2862
- : (rowLength =
2863
- (rowLength << 4) |
2864
- (96 < lastIdx ? lastIdx - 87 : lastIdx - 48));
2865
- continue;
2866
- case 3:
2867
- lastIdx = chunk.indexOf(10, i);
2885
+ ) {
2886
+ var lastIdx = -1;
2887
+ switch (rowState) {
2888
+ case 0:
2889
+ lastIdx = chunk[i++];
2890
+ 58 === lastIdx
2891
+ ? (rowState = 1)
2892
+ : (rowID =
2893
+ (rowID << 4) |
2894
+ (96 < lastIdx ? lastIdx - 87 : lastIdx - 48));
2895
+ continue;
2896
+ case 1:
2897
+ rowState = chunk[i];
2898
+ 84 === rowState ||
2899
+ 65 === rowState ||
2900
+ 79 === rowState ||
2901
+ 111 === rowState ||
2902
+ 85 === rowState ||
2903
+ 83 === rowState ||
2904
+ 115 === rowState ||
2905
+ 76 === rowState ||
2906
+ 108 === rowState ||
2907
+ 71 === rowState ||
2908
+ 103 === rowState ||
2909
+ 77 === rowState ||
2910
+ 109 === rowState ||
2911
+ 86 === rowState
2912
+ ? ((rowTag = rowState), (rowState = 2), i++)
2913
+ : (64 < rowState && 91 > rowState) ||
2914
+ 35 === rowState ||
2915
+ 114 === rowState ||
2916
+ 120 === rowState
2917
+ ? ((rowTag = rowState), (rowState = 3), i++)
2918
+ : ((rowTag = 0), (rowState = 3));
2919
+ continue;
2920
+ case 2:
2921
+ lastIdx = chunk[i++];
2922
+ 44 === lastIdx
2923
+ ? (rowState = 4)
2924
+ : (rowLength =
2925
+ (rowLength << 4) |
2926
+ (96 < lastIdx ? lastIdx - 87 : lastIdx - 48));
2927
+ continue;
2928
+ case 3:
2929
+ lastIdx = chunk.indexOf(10, i);
2930
+ break;
2931
+ case 4:
2932
+ (lastIdx = i + rowLength),
2933
+ lastIdx > chunk.length && (lastIdx = -1);
2934
+ }
2935
+ var offset = chunk.byteOffset + i;
2936
+ if (-1 < lastIdx)
2937
+ (rowLength = new Uint8Array(chunk.buffer, offset, lastIdx - i)),
2938
+ processFullBinaryRow(
2939
+ weakResponse,
2940
+ rowID,
2941
+ rowTag,
2942
+ buffer,
2943
+ rowLength
2944
+ ),
2945
+ (i = lastIdx),
2946
+ 3 === rowState && i++,
2947
+ (rowLength = rowID = rowTag = rowState = 0),
2948
+ (buffer.length = 0);
2949
+ else {
2950
+ chunk = new Uint8Array(chunk.buffer, offset, chunk.byteLength - i);
2951
+ buffer.push(chunk);
2952
+ rowLength -= chunk.byteLength;
2868
2953
  break;
2869
- case 4:
2870
- (lastIdx = i + rowLength), lastIdx > chunk.length && (lastIdx = -1);
2871
- }
2872
- var offset = chunk.byteOffset + i;
2873
- if (-1 < lastIdx)
2874
- (rowLength = new Uint8Array(chunk.buffer, offset, lastIdx - i)),
2875
- processFullBinaryRow(response, rowID, rowTag, buffer, rowLength),
2876
- (i = lastIdx),
2877
- 3 === rowState && i++,
2878
- (rowLength = rowID = rowTag = rowState = 0),
2879
- (buffer.length = 0);
2880
- else {
2881
- chunk = new Uint8Array(chunk.buffer, offset, chunk.byteLength - i);
2882
- buffer.push(chunk);
2883
- rowLength -= chunk.byteLength;
2884
- break;
2954
+ }
2885
2955
  }
2956
+ weakResponse._rowState = rowState;
2957
+ weakResponse._rowID = rowID;
2958
+ weakResponse._rowTag = rowTag;
2959
+ weakResponse._rowLength = rowLength;
2886
2960
  }
2887
- response._rowState = rowState;
2888
- response._rowID = rowID;
2889
- response._rowTag = rowTag;
2890
- response._rowLength = rowLength;
2891
2961
  }
2892
2962
  function createFromJSONCallback(response) {
2893
2963
  return function (key, value) {
@@ -2969,8 +3039,8 @@
2969
3039
  return value;
2970
3040
  };
2971
3041
  }
2972
- function close(response) {
2973
- reportGlobalError(response, Error("Connection closed."));
3042
+ function close(weakResponse) {
3043
+ reportGlobalError(weakResponse, Error("Connection closed."));
2974
3044
  }
2975
3045
  function noServerCall$1() {
2976
3046
  throw Error(
@@ -2992,7 +3062,7 @@
2992
3062
  options ? !0 === options.replayConsoleLogs : !1,
2993
3063
  options && options.environmentName ? options.environmentName : void 0,
2994
3064
  void 0
2995
- );
3065
+ )._weakResponse;
2996
3066
  }
2997
3067
  function startReadingFromStream(response, stream) {
2998
3068
  function progress(_ref) {
@@ -3089,7 +3159,11 @@
3089
3159
  "function" === typeof reject && reject(this.reason);
3090
3160
  }
3091
3161
  };
3092
- var initializingHandler = null,
3162
+ var debugChannelRegistry =
3163
+ "function" === typeof FinalizationRegistry
3164
+ ? new FinalizationRegistry(cleanupDebugChannel)
3165
+ : null,
3166
+ initializingHandler = null,
3093
3167
  supportsCreateTask = !!console.createTask,
3094
3168
  fakeFunctionCache = new Map(),
3095
3169
  fakeFunctionIdx = 0,
@@ -3198,14 +3272,14 @@
3198
3272
  reportGlobalError(response, e);
3199
3273
  }
3200
3274
  );
3201
- return getChunk(response, 0);
3275
+ return getRoot(response);
3202
3276
  };
3203
3277
  exports.createFromNodeStream = function (
3204
3278
  stream,
3205
3279
  serverConsumerManifest,
3206
3280
  options
3207
3281
  ) {
3208
- var response = new ResponseInstance(
3282
+ var response$jscomp$0 = new ResponseInstance(
3209
3283
  serverConsumerManifest.moduleMap,
3210
3284
  serverConsumerManifest.serverModuleMap,
3211
3285
  serverConsumerManifest.moduleLoading,
@@ -3217,109 +3291,112 @@
3217
3291
  options ? !0 === options.replayConsoleLogs : !1,
3218
3292
  options && options.environmentName ? options.environmentName : void 0,
3219
3293
  void 0
3220
- );
3294
+ )._weakResponse;
3221
3295
  stream.on("data", function (chunk) {
3222
3296
  if ("string" === typeof chunk) {
3223
- for (
3224
- var i = 0,
3225
- rowState = response._rowState,
3226
- rowID = response._rowID,
3227
- rowTag = response._rowTag,
3228
- rowLength = response._rowLength,
3229
- buffer = response._buffer,
3230
- chunkLength = chunk.length;
3231
- i < chunkLength;
3297
+ if (void 0 !== response$jscomp$0.weak.deref()) {
3298
+ for (
3299
+ var response = unwrapWeakResponse(response$jscomp$0),
3300
+ i = 0,
3301
+ rowState = response._rowState,
3302
+ rowID = response._rowID,
3303
+ rowTag = response._rowTag,
3304
+ rowLength = response._rowLength,
3305
+ buffer = response._buffer,
3306
+ chunkLength = chunk.length;
3307
+ i < chunkLength;
3232
3308
 
3233
- ) {
3234
- var lastIdx = -1;
3235
- switch (rowState) {
3236
- case 0:
3237
- lastIdx = chunk.charCodeAt(i++);
3238
- 58 === lastIdx
3239
- ? (rowState = 1)
3240
- : (rowID =
3241
- (rowID << 4) |
3242
- (96 < lastIdx ? lastIdx - 87 : lastIdx - 48));
3243
- continue;
3244
- case 1:
3245
- rowState = chunk.charCodeAt(i);
3246
- 84 === rowState ||
3247
- 65 === rowState ||
3248
- 79 === rowState ||
3249
- 111 === rowState ||
3250
- 85 === rowState ||
3251
- 83 === rowState ||
3252
- 115 === rowState ||
3253
- 76 === rowState ||
3254
- 108 === rowState ||
3255
- 71 === rowState ||
3256
- 103 === rowState ||
3257
- 77 === rowState ||
3258
- 109 === rowState ||
3259
- 86 === rowState
3260
- ? ((rowTag = rowState), (rowState = 2), i++)
3261
- : (64 < rowState && 91 > rowState) ||
3262
- 114 === rowState ||
3263
- 120 === rowState
3264
- ? ((rowTag = rowState), (rowState = 3), i++)
3265
- : ((rowTag = 0), (rowState = 3));
3266
- continue;
3267
- case 2:
3268
- lastIdx = chunk.charCodeAt(i++);
3269
- 44 === lastIdx
3270
- ? (rowState = 4)
3271
- : (rowLength =
3272
- (rowLength << 4) |
3273
- (96 < lastIdx ? lastIdx - 87 : lastIdx - 48));
3274
- continue;
3275
- case 3:
3276
- lastIdx = chunk.indexOf("\n", i);
3277
- break;
3278
- case 4:
3279
- if (84 !== rowTag)
3280
- throw Error(
3281
- "Binary RSC chunks cannot be encoded as strings. This is a bug in the wiring of the React streams."
3282
- );
3283
- if (rowLength < chunk.length || chunk.length > 3 * rowLength)
3309
+ ) {
3310
+ var lastIdx = -1;
3311
+ switch (rowState) {
3312
+ case 0:
3313
+ lastIdx = chunk.charCodeAt(i++);
3314
+ 58 === lastIdx
3315
+ ? (rowState = 1)
3316
+ : (rowID =
3317
+ (rowID << 4) |
3318
+ (96 < lastIdx ? lastIdx - 87 : lastIdx - 48));
3319
+ continue;
3320
+ case 1:
3321
+ rowState = chunk.charCodeAt(i);
3322
+ 84 === rowState ||
3323
+ 65 === rowState ||
3324
+ 79 === rowState ||
3325
+ 111 === rowState ||
3326
+ 85 === rowState ||
3327
+ 83 === rowState ||
3328
+ 115 === rowState ||
3329
+ 76 === rowState ||
3330
+ 108 === rowState ||
3331
+ 71 === rowState ||
3332
+ 103 === rowState ||
3333
+ 77 === rowState ||
3334
+ 109 === rowState ||
3335
+ 86 === rowState
3336
+ ? ((rowTag = rowState), (rowState = 2), i++)
3337
+ : (64 < rowState && 91 > rowState) ||
3338
+ 114 === rowState ||
3339
+ 120 === rowState
3340
+ ? ((rowTag = rowState), (rowState = 3), i++)
3341
+ : ((rowTag = 0), (rowState = 3));
3342
+ continue;
3343
+ case 2:
3344
+ lastIdx = chunk.charCodeAt(i++);
3345
+ 44 === lastIdx
3346
+ ? (rowState = 4)
3347
+ : (rowLength =
3348
+ (rowLength << 4) |
3349
+ (96 < lastIdx ? lastIdx - 87 : lastIdx - 48));
3350
+ continue;
3351
+ case 3:
3352
+ lastIdx = chunk.indexOf("\n", i);
3353
+ break;
3354
+ case 4:
3355
+ if (84 !== rowTag)
3356
+ throw Error(
3357
+ "Binary RSC chunks cannot be encoded as strings. This is a bug in the wiring of the React streams."
3358
+ );
3359
+ if (rowLength < chunk.length || chunk.length > 3 * rowLength)
3360
+ throw Error(
3361
+ "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."
3362
+ );
3363
+ lastIdx = chunk.length;
3364
+ }
3365
+ if (-1 < lastIdx) {
3366
+ if (0 < buffer.length)
3284
3367
  throw Error(
3285
3368
  "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."
3286
3369
  );
3287
- lastIdx = chunk.length;
3288
- }
3289
- if (-1 < lastIdx) {
3290
- if (0 < buffer.length)
3370
+ i = chunk.slice(i, lastIdx);
3371
+ processFullStringRow(response, rowID, rowTag, i);
3372
+ i = lastIdx;
3373
+ 3 === rowState && i++;
3374
+ rowLength = rowID = rowTag = rowState = 0;
3375
+ buffer.length = 0;
3376
+ } else if (chunk.length !== i)
3291
3377
  throw Error(
3292
3378
  "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."
3293
3379
  );
3294
- i = chunk.slice(i, lastIdx);
3295
- processFullStringRow(response, rowID, rowTag, i);
3296
- i = lastIdx;
3297
- 3 === rowState && i++;
3298
- rowLength = rowID = rowTag = rowState = 0;
3299
- buffer.length = 0;
3300
- } else if (chunk.length !== i)
3301
- throw Error(
3302
- "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."
3303
- );
3380
+ }
3381
+ response._rowState = rowState;
3382
+ response._rowID = rowID;
3383
+ response._rowTag = rowTag;
3384
+ response._rowLength = rowLength;
3304
3385
  }
3305
- response._rowState = rowState;
3306
- response._rowID = rowID;
3307
- response._rowTag = rowTag;
3308
- response._rowLength = rowLength;
3309
- } else processBinaryChunk(response, chunk);
3386
+ } else processBinaryChunk(response$jscomp$0, chunk);
3310
3387
  });
3311
3388
  stream.on("error", function (error) {
3312
- reportGlobalError(response, error);
3389
+ reportGlobalError(response$jscomp$0, error);
3313
3390
  });
3314
3391
  stream.on("end", function () {
3315
- return close(response);
3392
+ return close(response$jscomp$0);
3316
3393
  });
3317
- return getChunk(response, 0);
3394
+ return getRoot(response$jscomp$0);
3318
3395
  };
3319
3396
  exports.createFromReadableStream = function (stream, options) {
3320
3397
  options = createResponseFromOptions(options);
3321
3398
  startReadingFromStream(options, stream);
3322
- return getChunk(options, 0);
3399
+ return getRoot(options);
3323
3400
  };
3324
3401
  exports.createServerReference = function (id) {
3325
3402
  return createServerReference$1(id, noServerCall$1);