react-server-dom-webpack 19.0.0-rc-a26e3f403e-20240611 → 19.0.0-rc-dfd30974ab-20240613

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.
@@ -873,6 +873,62 @@
873
873
  registerServerReference(proxy, { id: id, bound: null }, encodeFormAction);
874
874
  return proxy;
875
875
  }
876
+ function getComponentNameFromType(type) {
877
+ if (null == type) return null;
878
+ if ("function" === typeof type)
879
+ return type.$$typeof === REACT_CLIENT_REFERENCE
880
+ ? null
881
+ : type.displayName || type.name || null;
882
+ if ("string" === typeof type) return type;
883
+ switch (type) {
884
+ case REACT_FRAGMENT_TYPE:
885
+ return "Fragment";
886
+ case REACT_PORTAL_TYPE:
887
+ return "Portal";
888
+ case REACT_PROFILER_TYPE:
889
+ return "Profiler";
890
+ case REACT_STRICT_MODE_TYPE:
891
+ return "StrictMode";
892
+ case REACT_SUSPENSE_TYPE:
893
+ return "Suspense";
894
+ case REACT_SUSPENSE_LIST_TYPE:
895
+ return "SuspenseList";
896
+ }
897
+ if ("object" === typeof type)
898
+ switch (
899
+ ("number" === typeof type.tag &&
900
+ error$jscomp$0(
901
+ "Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."
902
+ ),
903
+ type.$$typeof)
904
+ ) {
905
+ case REACT_CONTEXT_TYPE:
906
+ return (type.displayName || "Context") + ".Provider";
907
+ case REACT_CONSUMER_TYPE:
908
+ return (type._context.displayName || "Context") + ".Consumer";
909
+ case REACT_FORWARD_REF_TYPE:
910
+ var innerType = type.render;
911
+ type = type.displayName;
912
+ type ||
913
+ ((type = innerType.displayName || innerType.name || ""),
914
+ (type = "" !== type ? "ForwardRef(" + type + ")" : "ForwardRef"));
915
+ return type;
916
+ case REACT_MEMO_TYPE:
917
+ return (
918
+ (innerType = type.displayName || null),
919
+ null !== innerType
920
+ ? innerType
921
+ : getComponentNameFromType(type.type) || "Memo"
922
+ );
923
+ case REACT_LAZY_TYPE:
924
+ innerType = type._payload;
925
+ type = type._init;
926
+ try {
927
+ return getComponentNameFromType(type(innerType));
928
+ } catch (x) {}
929
+ }
930
+ return null;
931
+ }
876
932
  function Chunk(status, value, reason, response) {
877
933
  this.status = status;
878
934
  this.value = value;
@@ -893,7 +949,6 @@
893
949
  return chunk.value;
894
950
  case "pending":
895
951
  case "blocked":
896
- case "cyclic":
897
952
  throw chunk;
898
953
  default:
899
954
  throw chunk.reason;
@@ -912,7 +967,6 @@
912
967
  break;
913
968
  case "pending":
914
969
  case "blocked":
915
- case "cyclic":
916
970
  if (chunk.value)
917
971
  for (var i = 0; i < resolveListeners.length; i++)
918
972
  chunk.value.push(resolveListeners[i]);
@@ -983,33 +1037,33 @@
983
1037
  }
984
1038
  }
985
1039
  function initializeModelChunk(chunk) {
986
- var prevChunk = initializingChunk,
987
- prevBlocked = initializingChunkBlockedModel;
988
- initializingChunk = chunk;
989
- initializingChunkBlockedModel = null;
1040
+ var prevHandler = initializingHandler;
1041
+ initializingHandler = null;
990
1042
  var resolvedModel = chunk.value;
991
- chunk.status = "cyclic";
1043
+ chunk.status = "blocked";
992
1044
  chunk.value = null;
993
1045
  chunk.reason = null;
994
1046
  try {
995
- var value = JSON.parse(resolvedModel, chunk._response._fromJSON);
996
- if (
997
- null !== initializingChunkBlockedModel &&
998
- 0 < initializingChunkBlockedModel.deps
999
- )
1000
- (initializingChunkBlockedModel.value = value),
1001
- (chunk.status = "blocked");
1002
- else {
1003
- var resolveListeners = chunk.value;
1004
- chunk.status = "fulfilled";
1005
- chunk.value = value;
1006
- null !== resolveListeners && wakeChunk(resolveListeners, value);
1047
+ var value = JSON.parse(resolvedModel, chunk._response._fromJSON),
1048
+ resolveListeners = chunk.value;
1049
+ null !== resolveListeners &&
1050
+ ((chunk.value = null),
1051
+ (chunk.reason = null),
1052
+ wakeChunk(resolveListeners, value));
1053
+ if (null !== initializingHandler) {
1054
+ if (initializingHandler.errored) throw initializingHandler.value;
1055
+ if (0 < initializingHandler.deps) {
1056
+ initializingHandler.value = value;
1057
+ initializingHandler.chunk = chunk;
1058
+ return;
1059
+ }
1007
1060
  }
1061
+ chunk.status = "fulfilled";
1062
+ chunk.value = value;
1008
1063
  } catch (error$1) {
1009
1064
  (chunk.status = "rejected"), (chunk.reason = error$1);
1010
1065
  } finally {
1011
- (initializingChunk = prevChunk),
1012
- (initializingChunkBlockedModel = prevBlocked);
1066
+ initializingHandler = prevHandler;
1013
1067
  }
1014
1068
  }
1015
1069
  function initializeModuleChunk(chunk) {
@@ -1054,42 +1108,73 @@
1054
1108
  chunk || ((chunk = createPendingChunk(response)), chunks.set(id, chunk));
1055
1109
  return chunk;
1056
1110
  }
1057
- function createModelResolver(
1058
- chunk,
1111
+ function waitForReference(
1112
+ referencedChunk,
1059
1113
  parentObject,
1060
1114
  key,
1061
- cyclic,
1062
1115
  response,
1063
1116
  map,
1064
1117
  path
1065
1118
  ) {
1066
- if (initializingChunkBlockedModel) {
1067
- var blocked = initializingChunkBlockedModel;
1068
- cyclic || blocked.deps++;
1069
- } else
1070
- blocked = initializingChunkBlockedModel = {
1071
- deps: cyclic ? 0 : 1,
1072
- value: null
1073
- };
1074
- return function (value) {
1075
- for (var i = 1; i < path.length; i++) value = value[path[i]];
1119
+ function fulfill(value) {
1120
+ for (var i = 1; i < path.length; i++) {
1121
+ for (; value.$$typeof === REACT_LAZY_TYPE; )
1122
+ if (((value = value._payload), value === handler.chunk))
1123
+ value = handler.value;
1124
+ else if ("fulfilled" === value.status) value = value.value;
1125
+ else {
1126
+ path.splice(0, i - 1);
1127
+ value.then(fulfill, reject);
1128
+ return;
1129
+ }
1130
+ value = value[path[i]];
1131
+ }
1076
1132
  parentObject[key] = map(response, value);
1077
1133
  "" === key &&
1078
- null === blocked.value &&
1079
- (blocked.value = parentObject[key]);
1080
- blocked.deps--;
1081
- 0 === blocked.deps &&
1082
- "blocked" === chunk.status &&
1083
- ((value = chunk.value),
1084
- (chunk.status = "fulfilled"),
1085
- (chunk.value = blocked.value),
1086
- null !== value && wakeChunk(value, blocked.value));
1087
- };
1088
- }
1089
- function createModelReject(chunk) {
1090
- return function (error) {
1091
- return triggerErrorOnChunk(chunk, error);
1092
- };
1134
+ null === handler.value &&
1135
+ (handler.value = parentObject[key]);
1136
+ handler.deps--;
1137
+ 0 === handler.deps &&
1138
+ ((i = handler.chunk),
1139
+ null !== i &&
1140
+ "blocked" === i.status &&
1141
+ ((value = i.value),
1142
+ (i.status = "fulfilled"),
1143
+ (i.value = handler.value),
1144
+ null !== value && wakeChunk(value, handler.value)));
1145
+ }
1146
+ function reject(error) {
1147
+ if (!handler.errored) {
1148
+ var blockedValue = handler.value;
1149
+ handler.errored = !0;
1150
+ handler.value = error;
1151
+ var chunk = handler.chunk;
1152
+ null !== chunk &&
1153
+ "blocked" === chunk.status &&
1154
+ ("object" === typeof blockedValue &&
1155
+ null !== blockedValue &&
1156
+ blockedValue.$$typeof === REACT_ELEMENT_TYPE &&
1157
+ ((blockedValue = {
1158
+ name: getComponentNameFromType(blockedValue.type) || "",
1159
+ owner: blockedValue._owner
1160
+ }),
1161
+ (chunk._debugInfo || (chunk._debugInfo = [])).push(blockedValue)),
1162
+ triggerErrorOnChunk(chunk, error));
1163
+ }
1164
+ }
1165
+ if (initializingHandler) {
1166
+ var handler = initializingHandler;
1167
+ handler.deps++;
1168
+ } else
1169
+ handler = initializingHandler = {
1170
+ parent: null,
1171
+ chunk: null,
1172
+ value: null,
1173
+ deps: 1,
1174
+ errored: !1
1175
+ };
1176
+ referencedChunk.then(fulfill, reject);
1177
+ return null;
1093
1178
  }
1094
1179
  function createServerReferenceProxy(response, metaData) {
1095
1180
  function proxy() {
@@ -1127,7 +1212,7 @@
1127
1212
  id._debugInfo &&
1128
1213
  ("object" !== typeof response ||
1129
1214
  null === response ||
1130
- (!Array.isArray(response) &&
1215
+ (!isArrayImpl(response) &&
1131
1216
  "function" !== typeof response[ASYNC_ITERATOR] &&
1132
1217
  response.$$typeof !== REACT_ELEMENT_TYPE) ||
1133
1218
  response._debugInfo ||
@@ -1140,23 +1225,28 @@
1140
1225
  return response;
1141
1226
  case "pending":
1142
1227
  case "blocked":
1143
- case "cyclic":
1144
- var parentChunk = initializingChunk;
1145
- id.then(
1146
- createModelResolver(
1147
- parentChunk,
1148
- parentObject,
1149
- key,
1150
- "cyclic" === id.status,
1151
- response,
1152
- map,
1153
- reference
1154
- ),
1155
- createModelReject(parentChunk)
1228
+ return waitForReference(
1229
+ id,
1230
+ parentObject,
1231
+ key,
1232
+ response,
1233
+ map,
1234
+ reference
1156
1235
  );
1157
- return null;
1158
1236
  default:
1159
- throw id.reason;
1237
+ return (
1238
+ initializingHandler
1239
+ ? ((initializingHandler.errored = !0),
1240
+ (initializingHandler.value = id.reason))
1241
+ : (initializingHandler = {
1242
+ parent: null,
1243
+ chunk: null,
1244
+ value: id.reason,
1245
+ deps: 0,
1246
+ errored: !0
1247
+ }),
1248
+ null
1249
+ );
1160
1250
  }
1161
1251
  }
1162
1252
  function createMap(response, model) {
@@ -1182,7 +1272,19 @@
1182
1272
  }
1183
1273
  function parseModelString(response, parentObject, key, value) {
1184
1274
  if ("$" === value[0]) {
1185
- if ("$" === value) return REACT_ELEMENT_TYPE;
1275
+ if ("$" === value)
1276
+ return (
1277
+ null !== initializingHandler &&
1278
+ "0" === key &&
1279
+ (initializingHandler = {
1280
+ parent: initializingHandler,
1281
+ chunk: null,
1282
+ value: null,
1283
+ deps: 0,
1284
+ errored: !1
1285
+ }),
1286
+ REACT_ELEMENT_TYPE
1287
+ );
1186
1288
  switch (value[1]) {
1187
1289
  case "$":
1188
1290
  return value.slice(1);
@@ -1399,8 +1501,8 @@
1399
1501
  (previousBlockedChunk = chunk));
1400
1502
  } else {
1401
1503
  chunk = previousBlockedChunk;
1402
- var _chunk2 = createPendingChunk(response);
1403
- _chunk2.then(
1504
+ var _chunk3 = createPendingChunk(response);
1505
+ _chunk3.then(
1404
1506
  function (v) {
1405
1507
  return controller.enqueue(v);
1406
1508
  },
@@ -1408,10 +1510,10 @@
1408
1510
  return controller.error(e);
1409
1511
  }
1410
1512
  );
1411
- previousBlockedChunk = _chunk2;
1513
+ previousBlockedChunk = _chunk3;
1412
1514
  chunk.then(function () {
1413
- previousBlockedChunk === _chunk2 && (previousBlockedChunk = null);
1414
- resolveModelChunk(_chunk2, json);
1515
+ previousBlockedChunk === _chunk3 && (previousBlockedChunk = null);
1516
+ resolveModelChunk(_chunk3, json);
1415
1517
  });
1416
1518
  }
1417
1519
  },
@@ -1763,41 +1865,64 @@
1763
1865
  }
1764
1866
  function createFromJSONCallback(response) {
1765
1867
  return function (key, value) {
1766
- return "string" === typeof value
1767
- ? parseModelString(response, this, key, value)
1768
- : "object" === typeof value && null !== value
1769
- ? (value[0] === REACT_ELEMENT_TYPE
1770
- ? ((key = {
1771
- $$typeof: REACT_ELEMENT_TYPE,
1772
- type: value[1],
1773
- key: value[2],
1774
- props: value[3],
1775
- _owner: value[4]
1776
- }),
1777
- Object.defineProperty(key, "ref", {
1778
- enumerable: !1,
1779
- get: nullRefGetter
1780
- }),
1781
- (key._store = {}),
1782
- Object.defineProperty(key._store, "validated", {
1783
- configurable: !1,
1784
- enumerable: !1,
1785
- writable: !0,
1786
- value: 1
1787
- }),
1788
- Object.defineProperty(key, "_debugInfo", {
1789
- configurable: !1,
1790
- enumerable: !1,
1791
- writable: !0,
1792
- value: null
1793
- }),
1794
- null !== initializingChunkBlockedModel
1795
- ? ((value = Object.freeze.bind(Object, key.props)),
1796
- initializingChunk.then(value, value))
1797
- : Object.freeze(key.props))
1798
- : (key = value),
1799
- key)
1800
- : value;
1868
+ if ("string" === typeof value)
1869
+ return parseModelString(response, this, key, value);
1870
+ if ("object" === typeof value && null !== value) {
1871
+ if (value[0] === REACT_ELEMENT_TYPE)
1872
+ if (
1873
+ ((key = {
1874
+ $$typeof: REACT_ELEMENT_TYPE,
1875
+ type: value[1],
1876
+ key: value[2],
1877
+ props: value[3],
1878
+ _owner: value[4]
1879
+ }),
1880
+ Object.defineProperty(key, "ref", {
1881
+ enumerable: !1,
1882
+ get: nullRefGetter
1883
+ }),
1884
+ (key._store = {}),
1885
+ Object.defineProperty(key._store, "validated", {
1886
+ configurable: !1,
1887
+ enumerable: !1,
1888
+ writable: !0,
1889
+ value: 1
1890
+ }),
1891
+ Object.defineProperty(key, "_debugInfo", {
1892
+ configurable: !1,
1893
+ enumerable: !1,
1894
+ writable: !0,
1895
+ value: null
1896
+ }),
1897
+ null !== initializingHandler)
1898
+ ) {
1899
+ var handler = initializingHandler;
1900
+ initializingHandler = handler.parent;
1901
+ handler.errored
1902
+ ? ((value = new Chunk(
1903
+ "rejected",
1904
+ null,
1905
+ handler.value,
1906
+ response
1907
+ )),
1908
+ (key = {
1909
+ name: getComponentNameFromType(key.type) || "",
1910
+ owner: key._owner
1911
+ }),
1912
+ (value._debugInfo = [key]),
1913
+ (key = createLazyChunkWrapper(value)))
1914
+ : 0 < handler.deps &&
1915
+ ((value = new Chunk("blocked", null, null, response)),
1916
+ (handler.value = key),
1917
+ (handler.chunk = value),
1918
+ (key = Object.freeze.bind(Object, key.props)),
1919
+ value.then(key, key),
1920
+ (key = createLazyChunkWrapper(value)));
1921
+ } else Object.freeze(key.props);
1922
+ else key = value;
1923
+ return key;
1924
+ }
1925
+ return value;
1801
1926
  };
1802
1927
  }
1803
1928
  function noServerCall() {
@@ -1815,6 +1940,12 @@
1815
1940
  ReactSharedInternals =
1816
1941
  React.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,
1817
1942
  REACT_ELEMENT_TYPE = Symbol.for("react.transitional.element"),
1943
+ REACT_PORTAL_TYPE = Symbol.for("react.portal"),
1944
+ REACT_FRAGMENT_TYPE = Symbol.for("react.fragment"),
1945
+ REACT_STRICT_MODE_TYPE = Symbol.for("react.strict_mode"),
1946
+ REACT_PROFILER_TYPE = Symbol.for("react.profiler");
1947
+ Symbol.for("react.provider");
1948
+ var REACT_CONSUMER_TYPE = Symbol.for("react.consumer"),
1818
1949
  REACT_CONTEXT_TYPE = Symbol.for("react.context"),
1819
1950
  REACT_FORWARD_REF_TYPE = Symbol.for("react.forward_ref"),
1820
1951
  REACT_SUSPENSE_TYPE = Symbol.for("react.suspense"),
@@ -1832,7 +1963,8 @@
1832
1963
  knownServerReferences = new WeakMap(),
1833
1964
  boundCache = new WeakMap(),
1834
1965
  FunctionBind = Function.prototype.bind,
1835
- ArraySlice = Array.prototype.slice;
1966
+ ArraySlice = Array.prototype.slice,
1967
+ REACT_CLIENT_REFERENCE = Symbol.for("react.client.reference");
1836
1968
  Chunk.prototype = Object.create(Promise.prototype);
1837
1969
  Chunk.prototype.then = function (resolve, reject) {
1838
1970
  switch (this.status) {
@@ -1848,7 +1980,6 @@
1848
1980
  break;
1849
1981
  case "pending":
1850
1982
  case "blocked":
1851
- case "cyclic":
1852
1983
  resolve &&
1853
1984
  (null === this.value && (this.value = []),
1854
1985
  this.value.push(resolve));
@@ -1860,8 +1991,7 @@
1860
1991
  reject && reject(this.reason);
1861
1992
  }
1862
1993
  };
1863
- var initializingChunk = null,
1864
- initializingChunkBlockedModel = null;
1994
+ var initializingHandler = null;
1865
1995
  exports.createFromNodeStream = function (stream, ssrManifest, options) {
1866
1996
  var response = new ResponseInstance(
1867
1997
  ssrManifest.moduleMap,