react-server-dom-webpack 19.0.0-rc-a26e3f403e-20240611 → 19.0.0-rc-f3e09d6328-20240612

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.
@@ -894,6 +894,62 @@
894
894
  registerServerReference(proxy, { id: id, bound: null }, encodeFormAction);
895
895
  return proxy;
896
896
  }
897
+ function getComponentNameFromType(type) {
898
+ if (null == type) return null;
899
+ if ("function" === typeof type)
900
+ return type.$$typeof === REACT_CLIENT_REFERENCE
901
+ ? null
902
+ : type.displayName || type.name || null;
903
+ if ("string" === typeof type) return type;
904
+ switch (type) {
905
+ case REACT_FRAGMENT_TYPE:
906
+ return "Fragment";
907
+ case REACT_PORTAL_TYPE:
908
+ return "Portal";
909
+ case REACT_PROFILER_TYPE:
910
+ return "Profiler";
911
+ case REACT_STRICT_MODE_TYPE:
912
+ return "StrictMode";
913
+ case REACT_SUSPENSE_TYPE:
914
+ return "Suspense";
915
+ case REACT_SUSPENSE_LIST_TYPE:
916
+ return "SuspenseList";
917
+ }
918
+ if ("object" === typeof type)
919
+ switch (
920
+ ("number" === typeof type.tag &&
921
+ error$jscomp$0(
922
+ "Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."
923
+ ),
924
+ type.$$typeof)
925
+ ) {
926
+ case REACT_CONTEXT_TYPE:
927
+ return (type.displayName || "Context") + ".Provider";
928
+ case REACT_CONSUMER_TYPE:
929
+ return (type._context.displayName || "Context") + ".Consumer";
930
+ case REACT_FORWARD_REF_TYPE:
931
+ var innerType = type.render;
932
+ type = type.displayName;
933
+ type ||
934
+ ((type = innerType.displayName || innerType.name || ""),
935
+ (type = "" !== type ? "ForwardRef(" + type + ")" : "ForwardRef"));
936
+ return type;
937
+ case REACT_MEMO_TYPE:
938
+ return (
939
+ (innerType = type.displayName || null),
940
+ null !== innerType
941
+ ? innerType
942
+ : getComponentNameFromType(type.type) || "Memo"
943
+ );
944
+ case REACT_LAZY_TYPE:
945
+ innerType = type._payload;
946
+ type = type._init;
947
+ try {
948
+ return getComponentNameFromType(type(innerType));
949
+ } catch (x) {}
950
+ }
951
+ return null;
952
+ }
897
953
  function Chunk(status, value, reason, response) {
898
954
  this.status = status;
899
955
  this.value = value;
@@ -914,7 +970,6 @@
914
970
  return chunk.value;
915
971
  case "pending":
916
972
  case "blocked":
917
- case "cyclic":
918
973
  throw chunk;
919
974
  default:
920
975
  throw chunk.reason;
@@ -933,7 +988,6 @@
933
988
  break;
934
989
  case "pending":
935
990
  case "blocked":
936
- case "cyclic":
937
991
  if (chunk.value)
938
992
  for (var i = 0; i < resolveListeners.length; i++)
939
993
  chunk.value.push(resolveListeners[i]);
@@ -1004,33 +1058,33 @@
1004
1058
  }
1005
1059
  }
1006
1060
  function initializeModelChunk(chunk) {
1007
- var prevChunk = initializingChunk,
1008
- prevBlocked = initializingChunkBlockedModel;
1009
- initializingChunk = chunk;
1010
- initializingChunkBlockedModel = null;
1061
+ var prevHandler = initializingHandler;
1062
+ initializingHandler = null;
1011
1063
  var resolvedModel = chunk.value;
1012
- chunk.status = "cyclic";
1064
+ chunk.status = "blocked";
1013
1065
  chunk.value = null;
1014
1066
  chunk.reason = null;
1015
1067
  try {
1016
- var value = JSON.parse(resolvedModel, chunk._response._fromJSON);
1017
- if (
1018
- null !== initializingChunkBlockedModel &&
1019
- 0 < initializingChunkBlockedModel.deps
1020
- )
1021
- (initializingChunkBlockedModel.value = value),
1022
- (chunk.status = "blocked");
1023
- else {
1024
- var resolveListeners = chunk.value;
1025
- chunk.status = "fulfilled";
1026
- chunk.value = value;
1027
- null !== resolveListeners && wakeChunk(resolveListeners, value);
1068
+ var value = JSON.parse(resolvedModel, chunk._response._fromJSON),
1069
+ resolveListeners = chunk.value;
1070
+ null !== resolveListeners &&
1071
+ ((chunk.value = null),
1072
+ (chunk.reason = null),
1073
+ wakeChunk(resolveListeners, value));
1074
+ if (null !== initializingHandler) {
1075
+ if (initializingHandler.errored) throw initializingHandler.value;
1076
+ if (0 < initializingHandler.deps) {
1077
+ initializingHandler.value = value;
1078
+ initializingHandler.chunk = chunk;
1079
+ return;
1080
+ }
1028
1081
  }
1082
+ chunk.status = "fulfilled";
1083
+ chunk.value = value;
1029
1084
  } catch (error$1) {
1030
1085
  (chunk.status = "rejected"), (chunk.reason = error$1);
1031
1086
  } finally {
1032
- (initializingChunk = prevChunk),
1033
- (initializingChunkBlockedModel = prevBlocked);
1087
+ initializingHandler = prevHandler;
1034
1088
  }
1035
1089
  }
1036
1090
  function initializeModuleChunk(chunk) {
@@ -1079,42 +1133,73 @@
1079
1133
  chunk || ((chunk = createPendingChunk(response)), chunks.set(id, chunk));
1080
1134
  return chunk;
1081
1135
  }
1082
- function createModelResolver(
1083
- chunk,
1136
+ function waitForReference(
1137
+ referencedChunk,
1084
1138
  parentObject,
1085
1139
  key,
1086
- cyclic,
1087
1140
  response,
1088
1141
  map,
1089
1142
  path
1090
1143
  ) {
1091
- if (initializingChunkBlockedModel) {
1092
- var blocked = initializingChunkBlockedModel;
1093
- cyclic || blocked.deps++;
1094
- } else
1095
- blocked = initializingChunkBlockedModel = {
1096
- deps: cyclic ? 0 : 1,
1097
- value: null
1098
- };
1099
- return function (value) {
1100
- for (var i = 1; i < path.length; i++) value = value[path[i]];
1144
+ function fulfill(value) {
1145
+ for (var i = 1; i < path.length; i++) {
1146
+ for (; value.$$typeof === REACT_LAZY_TYPE; )
1147
+ if (((value = value._payload), value === handler.chunk))
1148
+ value = handler.value;
1149
+ else if ("fulfilled" === value.status) value = value.value;
1150
+ else {
1151
+ path.splice(0, i - 1);
1152
+ value.then(fulfill, reject);
1153
+ return;
1154
+ }
1155
+ value = value[path[i]];
1156
+ }
1101
1157
  parentObject[key] = map(response, value);
1102
1158
  "" === key &&
1103
- null === blocked.value &&
1104
- (blocked.value = parentObject[key]);
1105
- blocked.deps--;
1106
- 0 === blocked.deps &&
1107
- "blocked" === chunk.status &&
1108
- ((value = chunk.value),
1109
- (chunk.status = "fulfilled"),
1110
- (chunk.value = blocked.value),
1111
- null !== value && wakeChunk(value, blocked.value));
1112
- };
1113
- }
1114
- function createModelReject(chunk) {
1115
- return function (error) {
1116
- return triggerErrorOnChunk(chunk, error);
1117
- };
1159
+ null === handler.value &&
1160
+ (handler.value = parentObject[key]);
1161
+ handler.deps--;
1162
+ 0 === handler.deps &&
1163
+ ((i = handler.chunk),
1164
+ null !== i &&
1165
+ "blocked" === i.status &&
1166
+ ((value = i.value),
1167
+ (i.status = "fulfilled"),
1168
+ (i.value = handler.value),
1169
+ null !== value && wakeChunk(value, handler.value)));
1170
+ }
1171
+ function reject(error) {
1172
+ if (!handler.errored) {
1173
+ var blockedValue = handler.value;
1174
+ handler.errored = !0;
1175
+ handler.value = error;
1176
+ var chunk = handler.chunk;
1177
+ null !== chunk &&
1178
+ "blocked" === chunk.status &&
1179
+ ("object" === typeof blockedValue &&
1180
+ null !== blockedValue &&
1181
+ blockedValue.$$typeof === REACT_ELEMENT_TYPE &&
1182
+ ((blockedValue = {
1183
+ name: getComponentNameFromType(blockedValue.type) || "",
1184
+ owner: blockedValue._owner
1185
+ }),
1186
+ (chunk._debugInfo || (chunk._debugInfo = [])).push(blockedValue)),
1187
+ triggerErrorOnChunk(chunk, error));
1188
+ }
1189
+ }
1190
+ if (initializingHandler) {
1191
+ var handler = initializingHandler;
1192
+ handler.deps++;
1193
+ } else
1194
+ handler = initializingHandler = {
1195
+ parent: null,
1196
+ chunk: null,
1197
+ value: null,
1198
+ deps: 1,
1199
+ errored: !1
1200
+ };
1201
+ referencedChunk.then(fulfill, reject);
1202
+ return null;
1118
1203
  }
1119
1204
  function createServerReferenceProxy(response, metaData) {
1120
1205
  function proxy() {
@@ -1152,7 +1237,7 @@
1152
1237
  id._debugInfo &&
1153
1238
  ("object" !== typeof response ||
1154
1239
  null === response ||
1155
- (!Array.isArray(response) &&
1240
+ (!isArrayImpl(response) &&
1156
1241
  "function" !== typeof response[ASYNC_ITERATOR] &&
1157
1242
  response.$$typeof !== REACT_ELEMENT_TYPE) ||
1158
1243
  response._debugInfo ||
@@ -1165,23 +1250,28 @@
1165
1250
  return response;
1166
1251
  case "pending":
1167
1252
  case "blocked":
1168
- case "cyclic":
1169
- var parentChunk = initializingChunk;
1170
- id.then(
1171
- createModelResolver(
1172
- parentChunk,
1173
- parentObject,
1174
- key,
1175
- "cyclic" === id.status,
1176
- response,
1177
- map,
1178
- reference
1179
- ),
1180
- createModelReject(parentChunk)
1253
+ return waitForReference(
1254
+ id,
1255
+ parentObject,
1256
+ key,
1257
+ response,
1258
+ map,
1259
+ reference
1181
1260
  );
1182
- return null;
1183
1261
  default:
1184
- throw id.reason;
1262
+ return (
1263
+ initializingHandler
1264
+ ? ((initializingHandler.errored = !0),
1265
+ (initializingHandler.value = id.reason))
1266
+ : (initializingHandler = {
1267
+ parent: null,
1268
+ chunk: null,
1269
+ value: id.reason,
1270
+ deps: 0,
1271
+ errored: !0
1272
+ }),
1273
+ null
1274
+ );
1185
1275
  }
1186
1276
  }
1187
1277
  function createMap(response, model) {
@@ -1207,7 +1297,19 @@
1207
1297
  }
1208
1298
  function parseModelString(response, parentObject, key, value) {
1209
1299
  if ("$" === value[0]) {
1210
- if ("$" === value) return REACT_ELEMENT_TYPE;
1300
+ if ("$" === value)
1301
+ return (
1302
+ null !== initializingHandler &&
1303
+ "0" === key &&
1304
+ (initializingHandler = {
1305
+ parent: initializingHandler,
1306
+ chunk: null,
1307
+ value: null,
1308
+ deps: 0,
1309
+ errored: !1
1310
+ }),
1311
+ REACT_ELEMENT_TYPE
1312
+ );
1211
1313
  switch (value[1]) {
1212
1314
  case "$":
1213
1315
  return value.slice(1);
@@ -1424,8 +1526,8 @@
1424
1526
  (previousBlockedChunk = chunk));
1425
1527
  } else {
1426
1528
  chunk = previousBlockedChunk;
1427
- var _chunk2 = createPendingChunk(response);
1428
- _chunk2.then(
1529
+ var _chunk3 = createPendingChunk(response);
1530
+ _chunk3.then(
1429
1531
  function (v) {
1430
1532
  return controller.enqueue(v);
1431
1533
  },
@@ -1433,10 +1535,10 @@
1433
1535
  return controller.error(e);
1434
1536
  }
1435
1537
  );
1436
- previousBlockedChunk = _chunk2;
1538
+ previousBlockedChunk = _chunk3;
1437
1539
  chunk.then(function () {
1438
- previousBlockedChunk === _chunk2 && (previousBlockedChunk = null);
1439
- resolveModelChunk(_chunk2, json);
1540
+ previousBlockedChunk === _chunk3 && (previousBlockedChunk = null);
1541
+ resolveModelChunk(_chunk3, json);
1440
1542
  });
1441
1543
  }
1442
1544
  },
@@ -1788,41 +1890,64 @@
1788
1890
  }
1789
1891
  function createFromJSONCallback(response) {
1790
1892
  return function (key, value) {
1791
- return "string" === typeof value
1792
- ? parseModelString(response, this, key, value)
1793
- : "object" === typeof value && null !== value
1794
- ? (value[0] === REACT_ELEMENT_TYPE
1795
- ? ((key = {
1796
- $$typeof: REACT_ELEMENT_TYPE,
1797
- type: value[1],
1798
- key: value[2],
1799
- props: value[3],
1800
- _owner: value[4]
1801
- }),
1802
- Object.defineProperty(key, "ref", {
1803
- enumerable: !1,
1804
- get: nullRefGetter
1805
- }),
1806
- (key._store = {}),
1807
- Object.defineProperty(key._store, "validated", {
1808
- configurable: !1,
1809
- enumerable: !1,
1810
- writable: !0,
1811
- value: 1
1812
- }),
1813
- Object.defineProperty(key, "_debugInfo", {
1814
- configurable: !1,
1815
- enumerable: !1,
1816
- writable: !0,
1817
- value: null
1818
- }),
1819
- null !== initializingChunkBlockedModel
1820
- ? ((value = Object.freeze.bind(Object, key.props)),
1821
- initializingChunk.then(value, value))
1822
- : Object.freeze(key.props))
1823
- : (key = value),
1824
- key)
1825
- : value;
1893
+ if ("string" === typeof value)
1894
+ return parseModelString(response, this, key, value);
1895
+ if ("object" === typeof value && null !== value) {
1896
+ if (value[0] === REACT_ELEMENT_TYPE)
1897
+ if (
1898
+ ((key = {
1899
+ $$typeof: REACT_ELEMENT_TYPE,
1900
+ type: value[1],
1901
+ key: value[2],
1902
+ props: value[3],
1903
+ _owner: value[4]
1904
+ }),
1905
+ Object.defineProperty(key, "ref", {
1906
+ enumerable: !1,
1907
+ get: nullRefGetter
1908
+ }),
1909
+ (key._store = {}),
1910
+ Object.defineProperty(key._store, "validated", {
1911
+ configurable: !1,
1912
+ enumerable: !1,
1913
+ writable: !0,
1914
+ value: 1
1915
+ }),
1916
+ Object.defineProperty(key, "_debugInfo", {
1917
+ configurable: !1,
1918
+ enumerable: !1,
1919
+ writable: !0,
1920
+ value: null
1921
+ }),
1922
+ null !== initializingHandler)
1923
+ ) {
1924
+ var handler = initializingHandler;
1925
+ initializingHandler = handler.parent;
1926
+ handler.errored
1927
+ ? ((value = new Chunk(
1928
+ "rejected",
1929
+ null,
1930
+ handler.value,
1931
+ response
1932
+ )),
1933
+ (key = {
1934
+ name: getComponentNameFromType(key.type) || "",
1935
+ owner: key._owner
1936
+ }),
1937
+ (value._debugInfo = [key]),
1938
+ (key = createLazyChunkWrapper(value)))
1939
+ : 0 < handler.deps &&
1940
+ ((value = new Chunk("blocked", null, null, response)),
1941
+ (handler.value = key),
1942
+ (handler.chunk = value),
1943
+ (key = Object.freeze.bind(Object, key.props)),
1944
+ value.then(key, key),
1945
+ (key = createLazyChunkWrapper(value)));
1946
+ } else Object.freeze(key.props);
1947
+ else key = value;
1948
+ return key;
1949
+ }
1950
+ return value;
1826
1951
  };
1827
1952
  }
1828
1953
  function noServerCall() {
@@ -1948,6 +2073,12 @@
1948
2073
  ReactSharedInternals =
1949
2074
  React.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,
1950
2075
  REACT_ELEMENT_TYPE = Symbol.for("react.transitional.element"),
2076
+ REACT_PORTAL_TYPE = Symbol.for("react.portal"),
2077
+ REACT_FRAGMENT_TYPE = Symbol.for("react.fragment"),
2078
+ REACT_STRICT_MODE_TYPE = Symbol.for("react.strict_mode"),
2079
+ REACT_PROFILER_TYPE = Symbol.for("react.profiler");
2080
+ Symbol.for("react.provider");
2081
+ var REACT_CONSUMER_TYPE = Symbol.for("react.consumer"),
1951
2082
  REACT_CONTEXT_TYPE = Symbol.for("react.context"),
1952
2083
  REACT_FORWARD_REF_TYPE = Symbol.for("react.forward_ref"),
1953
2084
  REACT_SUSPENSE_TYPE = Symbol.for("react.suspense"),
@@ -1965,7 +2096,8 @@
1965
2096
  knownServerReferences = new WeakMap(),
1966
2097
  boundCache = new WeakMap(),
1967
2098
  FunctionBind = Function.prototype.bind,
1968
- ArraySlice = Array.prototype.slice;
2099
+ ArraySlice = Array.prototype.slice,
2100
+ REACT_CLIENT_REFERENCE = Symbol.for("react.client.reference");
1969
2101
  Chunk.prototype = Object.create(Promise.prototype);
1970
2102
  Chunk.prototype.then = function (resolve, reject) {
1971
2103
  switch (this.status) {
@@ -1981,7 +2113,6 @@
1981
2113
  break;
1982
2114
  case "pending":
1983
2115
  case "blocked":
1984
- case "cyclic":
1985
2116
  resolve &&
1986
2117
  (null === this.value && (this.value = []),
1987
2118
  this.value.push(resolve));
@@ -1993,8 +2124,7 @@
1993
2124
  reject && reject(this.reason);
1994
2125
  }
1995
2126
  };
1996
- var initializingChunk = null,
1997
- initializingChunkBlockedModel = null;
2127
+ var initializingHandler = null;
1998
2128
  exports.createFromFetch = function (promiseForResponse, options) {
1999
2129
  var response = createResponseFromOptions(options);
2000
2130
  promiseForResponse.then(