react-server-dom-webpack 19.0.0-rc-3da26163a3-20240704 → 19.0.0-rc-df783f9ea1-20240708

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.
@@ -326,6 +326,24 @@
326
326
  if (!(object[i] in ObjectPrototype)) return !1;
327
327
  return !0;
328
328
  }
329
+ function isSimpleObject(object) {
330
+ if (!isObjectPrototype(getPrototypeOf(object))) return !1;
331
+ for (
332
+ var names = Object.getOwnPropertyNames(object), i = 0;
333
+ i < names.length;
334
+ i++
335
+ ) {
336
+ var descriptor = Object.getOwnPropertyDescriptor(object, names[i]);
337
+ if (
338
+ !descriptor ||
339
+ (!descriptor.enumerable &&
340
+ (("key" !== names[i] && "ref" !== names[i]) ||
341
+ "function" !== typeof descriptor.get))
342
+ )
343
+ return !1;
344
+ }
345
+ return !0;
346
+ }
329
347
  function objectName(object) {
330
348
  return Object.prototype.toString
331
349
  .call(object)
@@ -494,6 +512,9 @@
494
512
  error += "\n at " + structuredStackTrace[i].toString();
495
513
  return error;
496
514
  }
515
+ function getCurrentStackInDEV() {
516
+ return "";
517
+ }
497
518
  function defaultErrorHandler(error) {
498
519
  console.error(error);
499
520
  }
@@ -515,6 +536,7 @@
515
536
  "Currently React only supports one RSC renderer at a time."
516
537
  );
517
538
  ReactSharedInternalsServer.A = DefaultAsyncDispatcher;
539
+ ReactSharedInternalsServer.getCurrentStack = getCurrentStackInDEV;
518
540
  var abortSet = new Set(),
519
541
  pingedTasks = [],
520
542
  hints = new Set();
@@ -581,7 +603,7 @@
581
603
  );
582
604
  case "rejected":
583
605
  task = thenable.reason;
584
- var digest = logRecoverableError(request, task);
606
+ var digest = logRecoverableError(request, task, null);
585
607
  emitErrorChunk(request, newTask.id, digest, task);
586
608
  return newTask.id;
587
609
  default:
@@ -614,7 +636,7 @@
614
636
  },
615
637
  function (reason) {
616
638
  newTask.status = 4;
617
- var _digest = logRecoverableError(request, reason);
639
+ var _digest = logRecoverableError(request, reason, newTask);
618
640
  emitErrorChunk(request, newTask.id, _digest, reason);
619
641
  request.abortableTasks.delete(newTask);
620
642
  enqueueFlush(request);
@@ -646,7 +668,7 @@
646
668
  if (!aborted) {
647
669
  aborted = !0;
648
670
  request.abortListeners.delete(error);
649
- var digest = logRecoverableError(request, reason);
671
+ var digest = logRecoverableError(request, reason, streamTask);
650
672
  emitErrorChunk(request, streamTask.id, digest, reason);
651
673
  enqueueFlush(request);
652
674
  reader.cancel(reason).then(error, error);
@@ -717,7 +739,7 @@
717
739
  if (!aborted) {
718
740
  aborted = !0;
719
741
  request.abortListeners.delete(error);
720
- var digest = logRecoverableError(request, reason);
742
+ var digest = logRecoverableError(request, reason, streamTask);
721
743
  emitErrorChunk(request, streamTask.id, digest, reason);
722
744
  enqueueFlush(request);
723
745
  "function" === typeof iterator.throw &&
@@ -801,32 +823,41 @@
801
823
  var init = lazy._init;
802
824
  return init(lazy._payload);
803
825
  }
804
- function renderFunctionComponent(
805
- request,
806
- task,
807
- key,
808
- Component,
809
- props,
810
- owner,
811
- stack,
812
- debugTask
813
- ) {
814
- stack = task.thenableState;
826
+ function callWithDebugContextInDEV(task, callback, arg) {
827
+ currentOwner = { env: task.environmentName, owner: task.debugOwner };
828
+ try {
829
+ return callback(arg);
830
+ } finally {
831
+ currentOwner = null;
832
+ }
833
+ }
834
+ function renderFunctionComponent(request, task, key, Component, props) {
835
+ var prevThenableState = task.thenableState;
815
836
  task.thenableState = null;
816
837
  if (null === debugID) return outlineTask(request, task);
817
- if (null !== stack) owner = stack._componentDebugInfo;
838
+ if (null !== prevThenableState)
839
+ var componentDebugInfo = prevThenableState._componentDebugInfo;
818
840
  else {
819
- var componentDebugID = debugID,
820
- componentName = Component.displayName || Component.name || "",
821
- componentEnv = request.environmentName();
841
+ var componentDebugID = debugID;
842
+ componentDebugInfo = Component.displayName || Component.name || "";
843
+ var componentEnv = request.environmentName();
822
844
  request.pendingChunks++;
823
- owner = { name: componentName, env: componentEnv, owner: owner };
824
- outlineModel(request, owner);
825
- emitDebugChunk(request, componentDebugID, owner);
845
+ componentDebugInfo = {
846
+ name: componentDebugInfo,
847
+ env: componentEnv,
848
+ owner: task.debugOwner
849
+ };
850
+ outlineModel(request, componentDebugInfo);
851
+ emitDebugChunk(request, componentDebugID, componentDebugInfo);
826
852
  task.environmentName = componentEnv;
827
853
  }
828
- prepareToUseHooksForComponent(stack, owner);
829
- props = callComponentInDEV(Component, props, owner, debugTask);
854
+ prepareToUseHooksForComponent(prevThenableState, componentDebugInfo);
855
+ props = callComponentInDEV(
856
+ Component,
857
+ props,
858
+ componentDebugInfo,
859
+ task.debugTask
860
+ );
830
861
  if (1 === request.status) throw AbortSigil;
831
862
  if (
832
863
  "object" === typeof props &&
@@ -834,8 +865,8 @@
834
865
  props.$$typeof !== CLIENT_REFERENCE_TAG$1
835
866
  ) {
836
867
  if ("function" === typeof props.then) {
837
- debugTask = props;
838
- debugTask.then(
868
+ prevThenableState = props;
869
+ prevThenableState.then(
839
870
  function (resolvedValue) {
840
871
  "object" === typeof resolvedValue &&
841
872
  null !== resolvedValue &&
@@ -844,7 +875,8 @@
844
875
  },
845
876
  function () {}
846
877
  );
847
- if ("fulfilled" === debugTask.status) return debugTask.value;
878
+ if ("fulfilled" === prevThenableState.status)
879
+ return prevThenableState.value;
848
880
  props = createLazyWrapperAroundWakeable(props);
849
881
  }
850
882
  var iteratorFn = getIteratorFn(props);
@@ -857,9 +889,11 @@
857
889
  Object.prototype.toString.call(Component) &&
858
890
  "[object Generator]" ===
859
891
  Object.prototype.toString.call(iterableChild)) ||
860
- error$jscomp$0(
861
- "Returning an Iterator from a Server Component is not supported since it cannot be looped over more than once. "
862
- );
892
+ callWithDebugContextInDEV(task, function () {
893
+ error$jscomp$0(
894
+ "Returning an Iterator from a Server Component is not supported since it cannot be looped over more than once. "
895
+ );
896
+ });
863
897
  return iterator;
864
898
  });
865
899
  props._debugInfo = iterableChild._debugInfo;
@@ -878,22 +912,25 @@
878
912
  Object.prototype.toString.call(Component) &&
879
913
  "[object AsyncGenerator]" ===
880
914
  Object.prototype.toString.call(_iterableChild)) ||
881
- error$jscomp$0(
882
- "Returning an AsyncIterator from a Server Component is not supported since it cannot be looped over more than once. "
883
- );
915
+ callWithDebugContextInDEV(task, function () {
916
+ error$jscomp$0(
917
+ "Returning an AsyncIterator from a Server Component is not supported since it cannot be looped over more than once. "
918
+ );
919
+ });
884
920
  return iterator;
885
921
  });
886
922
  props._debugInfo = _iterableChild._debugInfo;
887
923
  }
888
924
  }
889
- debugTask = task.keyPath;
890
- owner = task.implicitSlot;
925
+ prevThenableState = task.keyPath;
926
+ componentDebugID = task.implicitSlot;
891
927
  null !== key
892
- ? (task.keyPath = null === debugTask ? key : debugTask + "," + key)
893
- : null === debugTask && (task.implicitSlot = !0);
928
+ ? (task.keyPath =
929
+ null === prevThenableState ? key : prevThenableState + "," + key)
930
+ : null === prevThenableState && (task.implicitSlot = !0);
894
931
  request = renderModelDestructive(request, task, emptyRoot, "", props);
895
- task.keyPath = debugTask;
896
- task.implicitSlot = owner;
932
+ task.keyPath = prevThenableState;
933
+ task.implicitSlot = componentDebugID;
897
934
  return request;
898
935
  }
899
936
  function renderFragment(request, task, children) {
@@ -924,6 +961,21 @@
924
961
  }
925
962
  return children;
926
963
  }
964
+ function renderAsyncFragment(request, task, children, getAsyncIterator) {
965
+ if (null !== task.keyPath)
966
+ return (
967
+ (request = [
968
+ REACT_ELEMENT_TYPE,
969
+ REACT_FRAGMENT_TYPE,
970
+ task.keyPath,
971
+ { children: children },
972
+ null
973
+ ]),
974
+ task.implicitSlot ? [request] : request
975
+ );
976
+ getAsyncIterator = getAsyncIterator.call(children);
977
+ return serializeAsyncIterable(request, task, children, getAsyncIterator);
978
+ }
927
979
  function outlineTask(request, task) {
928
980
  task = createTask(
929
981
  request,
@@ -937,17 +989,7 @@
937
989
  ? serializeByValueID(task.id)
938
990
  : serializeLazyID(task.id);
939
991
  }
940
- function renderElement(
941
- request,
942
- task,
943
- type,
944
- key,
945
- ref,
946
- props,
947
- owner,
948
- stack,
949
- debugTask
950
- ) {
992
+ function renderElement(request, task, type, key, ref, props) {
951
993
  if (null !== ref && void 0 !== ref)
952
994
  throw Error(
953
995
  "Refs cannot be used in Server Components, nor passed to Client Components."
@@ -961,19 +1003,10 @@
961
1003
  type.$$typeof !== CLIENT_REFERENCE_TAG$1 &&
962
1004
  type.$$typeof !== TEMPORARY_REFERENCE_TAG
963
1005
  )
964
- return renderFunctionComponent(
965
- request,
966
- task,
967
- key,
968
- type,
969
- props,
970
- owner,
971
- stack,
972
- debugTask
973
- );
1006
+ return renderFunctionComponent(request, task, key, type, props);
974
1007
  if (type === REACT_FRAGMENT_TYPE && null === key)
975
1008
  return (
976
- (owner = task.implicitSlot),
1009
+ (type = task.implicitSlot),
977
1010
  null === task.keyPath && (task.implicitSlot = !0),
978
1011
  (props = renderModelDestructive(
979
1012
  request,
@@ -982,7 +1015,7 @@
982
1015
  "",
983
1016
  props.children
984
1017
  )),
985
- (task.implicitSlot = owner),
1018
+ (task.implicitSlot = type),
986
1019
  props
987
1020
  );
988
1021
  if (
@@ -994,40 +1027,17 @@
994
1027
  case REACT_LAZY_TYPE:
995
1028
  type = callLazyInitInDEV(type);
996
1029
  if (1 === request.status) throw AbortSigil;
997
- return renderElement(
998
- request,
999
- task,
1000
- type,
1001
- key,
1002
- ref,
1003
- props,
1004
- owner,
1005
- stack,
1006
- debugTask
1007
- );
1030
+ return renderElement(request, task, type, key, ref, props);
1008
1031
  case REACT_FORWARD_REF_TYPE:
1009
1032
  return renderFunctionComponent(
1010
1033
  request,
1011
1034
  task,
1012
1035
  key,
1013
1036
  type.render,
1014
- props,
1015
- owner,
1016
- stack,
1017
- debugTask
1037
+ props
1018
1038
  );
1019
1039
  case REACT_MEMO_TYPE:
1020
- return renderElement(
1021
- request,
1022
- task,
1023
- type.type,
1024
- key,
1025
- ref,
1026
- props,
1027
- owner,
1028
- stack,
1029
- debugTask
1030
- );
1040
+ return renderElement(request, task, type.type, key, ref, props);
1031
1041
  case REACT_ELEMENT_TYPE:
1032
1042
  type._store.validated = 1;
1033
1043
  }
@@ -1036,7 +1046,7 @@
1036
1046
  null === request
1037
1047
  ? (request = key)
1038
1048
  : null !== key && (request = key + "," + request);
1039
- props = [REACT_ELEMENT_TYPE, type, request, props, owner];
1049
+ props = [REACT_ELEMENT_TYPE, type, request, props, task.debugOwner];
1040
1050
  task = task.implicitSlot && null !== request ? [props] : props;
1041
1051
  return task;
1042
1052
  }
@@ -1067,95 +1077,30 @@
1067
1077
  return pingTask(request, task);
1068
1078
  },
1069
1079
  toJSON: function (parentPropertyName, value) {
1070
- var originalValue = this[parentPropertyName];
1080
+ var parent = this,
1081
+ originalValue = parent[parentPropertyName];
1071
1082
  "object" !== typeof originalValue ||
1072
1083
  originalValue === value ||
1073
1084
  originalValue instanceof Date ||
1074
- ("Object" !== objectName(originalValue)
1075
- ? "string" === typeof jsxChildrenParents.get(this)
1076
- ? error$jscomp$0(
1077
- "%s objects cannot be rendered as text children. Try formatting it using toString().%s",
1078
- objectName(originalValue),
1079
- describeObjectForErrorMessage(this, parentPropertyName)
1080
- )
1085
+ callWithDebugContextInDEV(task, function () {
1086
+ "Object" !== objectName(originalValue)
1087
+ ? "string" === typeof jsxChildrenParents.get(parent)
1088
+ ? error$jscomp$0(
1089
+ "%s objects cannot be rendered as text children. Try formatting it using toString().%s",
1090
+ objectName(originalValue),
1091
+ describeObjectForErrorMessage(parent, parentPropertyName)
1092
+ )
1093
+ : error$jscomp$0(
1094
+ "Only plain objects can be passed to Client Components from Server Components. %s objects are not supported.%s",
1095
+ objectName(originalValue),
1096
+ describeObjectForErrorMessage(parent, parentPropertyName)
1097
+ )
1081
1098
  : error$jscomp$0(
1082
- "Only plain objects can be passed to Client Components from Server Components. %s objects are not supported.%s",
1083
- objectName(originalValue),
1084
- describeObjectForErrorMessage(this, parentPropertyName)
1085
- )
1086
- : error$jscomp$0(
1087
- "Only plain objects can be passed to Client Components from Server Components. Objects with toJSON methods are not supported. Convert it manually to a simple value before passing it to props.%s",
1088
- describeObjectForErrorMessage(this, parentPropertyName)
1089
- ));
1090
- originalValue = task;
1091
- var prevKeyPath = originalValue.keyPath,
1092
- prevImplicitSlot = originalValue.implicitSlot;
1093
- try {
1094
- var JSCompiler_inline_result = renderModelDestructive(
1095
- request,
1096
- originalValue,
1097
- this,
1098
- parentPropertyName,
1099
- value
1100
- );
1101
- } catch (thrownValue) {
1102
- if (
1103
- ((parentPropertyName = originalValue.model),
1104
- (parentPropertyName =
1105
- "object" === typeof parentPropertyName &&
1106
- null !== parentPropertyName &&
1107
- (parentPropertyName.$$typeof === REACT_ELEMENT_TYPE ||
1108
- parentPropertyName.$$typeof === REACT_LAZY_TYPE)),
1109
- (value =
1110
- thrownValue === SuspenseException
1111
- ? getSuspendedThenable()
1112
- : thrownValue),
1113
- "object" === typeof value &&
1114
- null !== value &&
1115
- "function" === typeof value.then)
1116
- )
1117
- if (1 === request.status)
1118
- (originalValue.status = 3),
1119
- (originalValue = request.fatalError),
1120
- (JSCompiler_inline_result = parentPropertyName
1121
- ? serializeLazyID(originalValue)
1122
- : serializeByValueID(originalValue));
1123
- else {
1124
- JSCompiler_inline_result = createTask(
1125
- request,
1126
- originalValue.model,
1127
- originalValue.keyPath,
1128
- originalValue.implicitSlot,
1129
- request.abortableTasks
1130
- );
1131
- var ping = JSCompiler_inline_result.ping;
1132
- value.then(ping, ping);
1133
- JSCompiler_inline_result.thenableState =
1134
- getThenableStateAfterSuspending();
1135
- originalValue.keyPath = prevKeyPath;
1136
- originalValue.implicitSlot = prevImplicitSlot;
1137
- JSCompiler_inline_result = parentPropertyName
1138
- ? serializeLazyID(JSCompiler_inline_result.id)
1139
- : serializeByValueID(JSCompiler_inline_result.id);
1140
- }
1141
- else
1142
- thrownValue === AbortSigil
1143
- ? ((originalValue.status = 3),
1144
- (originalValue = request.fatalError),
1145
- (JSCompiler_inline_result = parentPropertyName
1146
- ? serializeLazyID(originalValue)
1147
- : serializeByValueID(originalValue)))
1148
- : ((originalValue.keyPath = prevKeyPath),
1149
- (originalValue.implicitSlot = prevImplicitSlot),
1150
- request.pendingChunks++,
1151
- (originalValue = request.nextChunkId++),
1152
- (prevKeyPath = logRecoverableError(request, value)),
1153
- emitErrorChunk(request, originalValue, prevKeyPath, value),
1154
- (JSCompiler_inline_result = parentPropertyName
1155
- ? serializeLazyID(originalValue)
1156
- : serializeByValueID(originalValue)));
1157
- }
1158
- return JSCompiler_inline_result;
1099
+ "Only plain objects can be passed to Client Components from Server Components. Objects with toJSON methods are not supported. Convert it manually to a simple value before passing it to props.%s",
1100
+ describeObjectForErrorMessage(parent, parentPropertyName)
1101
+ );
1102
+ });
1103
+ return renderModel(request, task, parent, parentPropertyName, value);
1159
1104
  },
1160
1105
  thenableState: null
1161
1106
  };
@@ -1234,7 +1179,7 @@
1234
1179
  return (
1235
1180
  request.pendingChunks++,
1236
1181
  (parent = request.nextChunkId++),
1237
- (parentPropertyName = logRecoverableError(request, x)),
1182
+ (parentPropertyName = logRecoverableError(request, x, null)),
1238
1183
  emitErrorChunk(request, parent, parentPropertyName, x),
1239
1184
  serializeByValueID(parent)
1240
1185
  );
@@ -1245,6 +1190,19 @@
1245
1190
  retryTask(request, value);
1246
1191
  return value.id;
1247
1192
  }
1193
+ function serializeServerReference(request, serverReference) {
1194
+ var writtenServerReferences = request.writtenServerReferences,
1195
+ existingId = writtenServerReferences.get(serverReference);
1196
+ if (void 0 !== existingId) return "$F" + existingId.toString(16);
1197
+ existingId = serverReference.$$bound;
1198
+ existingId = {
1199
+ id: serverReference.$$id,
1200
+ bound: existingId ? Promise.resolve(existingId) : null
1201
+ };
1202
+ request = outlineModel(request, existingId);
1203
+ writtenServerReferences.set(serverReference, request);
1204
+ return "$F" + request.toString(16);
1205
+ }
1248
1206
  function serializeLargeTextString(request, text) {
1249
1207
  request.pendingChunks++;
1250
1208
  var textId = request.nextChunkId++;
@@ -1285,7 +1243,7 @@
1285
1243
  if (!aborted) {
1286
1244
  aborted = !0;
1287
1245
  request.abortListeners.delete(error);
1288
- var digest = logRecoverableError(request, reason);
1246
+ var digest = logRecoverableError(request, reason, newTask);
1289
1247
  emitErrorChunk(request, newTask.id, digest, reason);
1290
1248
  request.abortableTasks.delete(newTask);
1291
1249
  enqueueFlush(request);
@@ -1300,6 +1258,66 @@
1300
1258
  reader.read().then(progress).catch(error);
1301
1259
  return "$B" + newTask.id.toString(16);
1302
1260
  }
1261
+ function renderModel(request, task, parent, key, value) {
1262
+ var prevKeyPath = task.keyPath,
1263
+ prevImplicitSlot = task.implicitSlot;
1264
+ try {
1265
+ return renderModelDestructive(request, task, parent, key, value);
1266
+ } catch (thrownValue) {
1267
+ parent = task.model;
1268
+ parent =
1269
+ "object" === typeof parent &&
1270
+ null !== parent &&
1271
+ (parent.$$typeof === REACT_ELEMENT_TYPE ||
1272
+ parent.$$typeof === REACT_LAZY_TYPE);
1273
+ key =
1274
+ thrownValue === SuspenseException
1275
+ ? getSuspendedThenable()
1276
+ : thrownValue;
1277
+ if (
1278
+ "object" === typeof key &&
1279
+ null !== key &&
1280
+ "function" === typeof key.then
1281
+ ) {
1282
+ if (1 === request.status)
1283
+ return (
1284
+ (task.status = 3),
1285
+ (task = request.fatalError),
1286
+ parent ? serializeLazyID(task) : serializeByValueID(task)
1287
+ );
1288
+ request = createTask(
1289
+ request,
1290
+ task.model,
1291
+ task.keyPath,
1292
+ task.implicitSlot,
1293
+ request.abortableTasks
1294
+ );
1295
+ value = request.ping;
1296
+ key.then(value, value);
1297
+ request.thenableState = getThenableStateAfterSuspending();
1298
+ task.keyPath = prevKeyPath;
1299
+ task.implicitSlot = prevImplicitSlot;
1300
+ return parent
1301
+ ? serializeLazyID(request.id)
1302
+ : serializeByValueID(request.id);
1303
+ }
1304
+ if (thrownValue === AbortSigil)
1305
+ return (
1306
+ (task.status = 3),
1307
+ (task = request.fatalError),
1308
+ parent ? serializeLazyID(task) : serializeByValueID(task)
1309
+ );
1310
+ task.keyPath = prevKeyPath;
1311
+ task.implicitSlot = prevImplicitSlot;
1312
+ request.pendingChunks++;
1313
+ prevKeyPath = request.nextChunkId++;
1314
+ task = logRecoverableError(request, key, task);
1315
+ emitErrorChunk(request, prevKeyPath, task, key);
1316
+ return parent
1317
+ ? serializeLazyID(prevKeyPath)
1318
+ : serializeByValueID(prevKeyPath);
1319
+ }
1320
+ }
1303
1321
  function renderModelDestructive(
1304
1322
  request,
1305
1323
  task,
@@ -1322,48 +1340,47 @@
1322
1340
  else return _existingReference;
1323
1341
  else
1324
1342
  -1 === parentPropertyName.indexOf(":") &&
1325
- ((parent = _writtenObjects.get(parent)),
1326
- void 0 !== parent &&
1327
- ((elementReference = parent + ":" + parentPropertyName),
1343
+ ((_existingReference = _writtenObjects.get(parent)),
1344
+ void 0 !== _existingReference &&
1345
+ ((elementReference =
1346
+ _existingReference + ":" + parentPropertyName),
1328
1347
  _writtenObjects.set(value, elementReference)));
1329
1348
  }
1330
- if ((parentPropertyName = value._debugInfo)) {
1349
+ if ((_existingReference = value._debugInfo)) {
1331
1350
  if (null === debugID) return outlineTask(request, task);
1332
- forwardDebugInfo(request, debugID, parentPropertyName);
1351
+ forwardDebugInfo(request, debugID, _existingReference);
1333
1352
  }
1334
- parentPropertyName = value.props;
1335
- parent = parentPropertyName.ref;
1336
- value = renderElement(
1353
+ _existingReference = value.props;
1354
+ var refProp = _existingReference.ref;
1355
+ task.debugOwner = value._owner;
1356
+ request = renderElement(
1337
1357
  request,
1338
1358
  task,
1339
1359
  value.type,
1340
1360
  value.key,
1341
- void 0 !== parent ? parent : null,
1342
- parentPropertyName,
1343
- value._owner,
1344
- null,
1345
- null
1361
+ void 0 !== refProp ? refProp : null,
1362
+ _existingReference
1346
1363
  );
1347
- "object" === typeof value &&
1348
- null !== value &&
1364
+ "object" === typeof request &&
1365
+ null !== request &&
1349
1366
  null !== elementReference &&
1350
- (_writtenObjects.has(value) ||
1351
- _writtenObjects.set(value, elementReference));
1352
- return value;
1367
+ (_writtenObjects.has(request) ||
1368
+ _writtenObjects.set(request, elementReference));
1369
+ return request;
1353
1370
  case REACT_LAZY_TYPE:
1354
1371
  task.thenableState = null;
1355
- parentPropertyName = callLazyInitInDEV(value);
1372
+ elementReference = callLazyInitInDEV(value);
1356
1373
  if (1 === request.status) throw AbortSigil;
1357
- if ((value = value._debugInfo)) {
1374
+ if ((_writtenObjects = value._debugInfo)) {
1358
1375
  if (null === debugID) return outlineTask(request, task);
1359
- forwardDebugInfo(request, debugID, value);
1376
+ forwardDebugInfo(request, debugID, _writtenObjects);
1360
1377
  }
1361
1378
  return renderModelDestructive(
1362
1379
  request,
1363
1380
  task,
1364
1381
  emptyRoot,
1365
1382
  "",
1366
- parentPropertyName
1383
+ elementReference
1367
1384
  );
1368
1385
  case REACT_LEGACY_ELEMENT_TYPE:
1369
1386
  throw Error(
@@ -1458,13 +1475,11 @@
1458
1475
  return serializeBlob(request, value);
1459
1476
  if ((elementReference = getIteratorFn(value)))
1460
1477
  return (
1461
- (parentPropertyName = elementReference.call(value)),
1462
- parentPropertyName === value
1478
+ (elementReference = elementReference.call(value)),
1479
+ elementReference === value
1463
1480
  ? "$i" +
1464
- outlineModel(request, Array.from(parentPropertyName)).toString(
1465
- 16
1466
- )
1467
- : renderFragment(request, task, Array.from(parentPropertyName))
1481
+ outlineModel(request, Array.from(elementReference)).toString(16)
1482
+ : renderFragment(request, task, Array.from(elementReference))
1468
1483
  );
1469
1484
  if (
1470
1485
  "function" === typeof ReadableStream &&
@@ -1473,25 +1488,7 @@
1473
1488
  return serializeReadableStream(request, task, value);
1474
1489
  elementReference = value[ASYNC_ITERATOR];
1475
1490
  if ("function" === typeof elementReference)
1476
- return (
1477
- null !== task.keyPath
1478
- ? ((value = [
1479
- REACT_ELEMENT_TYPE,
1480
- REACT_FRAGMENT_TYPE,
1481
- task.keyPath,
1482
- { children: value },
1483
- null
1484
- ]),
1485
- (value = task.implicitSlot ? [value] : value))
1486
- : ((parentPropertyName = elementReference.call(value)),
1487
- (value = serializeAsyncIterable(
1488
- request,
1489
- task,
1490
- value,
1491
- parentPropertyName
1492
- ))),
1493
- value
1494
- );
1491
+ return renderAsyncFragment(request, task, value, elementReference);
1495
1492
  request = getPrototypeOf(value);
1496
1493
  if (
1497
1494
  request !== ObjectPrototype &&
@@ -1511,43 +1508,30 @@
1511
1508
  )
1512
1509
  return { name: value.name, env: value.env, owner: value.owner };
1513
1510
  if ("Object" !== objectName(value))
1514
- error$jscomp$0(
1515
- "Only plain objects can be passed to Client Components from Server Components. %s objects are not supported.%s",
1516
- objectName(value),
1517
- describeObjectForErrorMessage(parent, parentPropertyName)
1518
- );
1519
- else {
1520
- a: if (isObjectPrototype(getPrototypeOf(value))) {
1521
- request = Object.getOwnPropertyNames(value);
1522
- for (task = 0; task < request.length; task++)
1523
- if (
1524
- ((elementReference = Object.getOwnPropertyDescriptor(
1525
- value,
1526
- request[task]
1527
- )),
1528
- !elementReference ||
1529
- (!elementReference.enumerable &&
1530
- (("key" !== request[task] && "ref" !== request[task]) ||
1531
- "function" !== typeof elementReference.get)))
1532
- ) {
1533
- request = !1;
1534
- break a;
1535
- }
1536
- request = !0;
1537
- } else request = !1;
1538
- request
1539
- ? Object.getOwnPropertySymbols &&
1540
- ((request = Object.getOwnPropertySymbols(value)),
1541
- 0 < request.length &&
1542
- error$jscomp$0(
1543
- "Only plain objects can be passed to Client Components from Server Components. Objects with symbol properties like %s are not supported.%s",
1544
- request[0].description,
1545
- describeObjectForErrorMessage(parent, parentPropertyName)
1546
- ))
1547
- : error$jscomp$0(
1548
- "Only plain objects can be passed to Client Components from Server Components. Classes or other objects with methods are not supported.%s",
1511
+ callWithDebugContextInDEV(task, function () {
1512
+ error$jscomp$0(
1513
+ "Only plain objects can be passed to Client Components from Server Components. %s objects are not supported.%s",
1514
+ objectName(value),
1515
+ describeObjectForErrorMessage(parent, parentPropertyName)
1516
+ );
1517
+ });
1518
+ else if (!isSimpleObject(value))
1519
+ callWithDebugContextInDEV(task, function () {
1520
+ error$jscomp$0(
1521
+ "Only plain objects can be passed to Client Components from Server Components. Classes or other objects with methods are not supported.%s",
1522
+ describeObjectForErrorMessage(parent, parentPropertyName)
1523
+ );
1524
+ });
1525
+ else if (Object.getOwnPropertySymbols) {
1526
+ var symbols = Object.getOwnPropertySymbols(value);
1527
+ 0 < symbols.length &&
1528
+ callWithDebugContextInDEV(task, function () {
1529
+ error$jscomp$0(
1530
+ "Only plain objects can be passed to Client Components from Server Components. Objects with symbol properties like %s are not supported.%s",
1531
+ symbols[0].description,
1549
1532
  describeObjectForErrorMessage(parent, parentPropertyName)
1550
1533
  );
1534
+ });
1551
1535
  }
1552
1536
  return value;
1553
1537
  }
@@ -1572,21 +1556,7 @@
1572
1556
  value
1573
1557
  );
1574
1558
  if (value.$$typeof === SERVER_REFERENCE_TAG)
1575
- return (
1576
- (parentPropertyName = request.writtenServerReferences),
1577
- (parent = parentPropertyName.get(value)),
1578
- void 0 !== parent
1579
- ? (value = "$F" + parent.toString(16))
1580
- : ((parent = value.$$bound),
1581
- (parent = {
1582
- id: value.$$id,
1583
- bound: parent ? Promise.resolve(parent) : null
1584
- }),
1585
- (request = outlineModel(request, parent)),
1586
- parentPropertyName.set(value, request),
1587
- (value = "$F" + request.toString(16))),
1588
- value
1589
- );
1559
+ return serializeServerReference(request, value);
1590
1560
  if (
1591
1561
  void 0 !== request.temporaryReferences &&
1592
1562
  ((request = request.temporaryReferences.get(value)),
@@ -1608,12 +1578,12 @@
1608
1578
  (jsxPropsParents.has(parent) && "children" === parentPropertyName)
1609
1579
  )
1610
1580
  throw (
1611
- ((value = value.displayName || value.name || "Component"),
1581
+ ((request = value.displayName || value.name || "Component"),
1612
1582
  Error(
1613
1583
  "Functions are not valid as a child of Client Components. This may happen if you return " +
1614
- value +
1584
+ request +
1615
1585
  " instead of <" +
1616
- value +
1586
+ request +
1617
1587
  " /> from render. Or maybe you meant to call this function rather than return it." +
1618
1588
  describeObjectForErrorMessage(parent, parentPropertyName)
1619
1589
  ))
@@ -1636,15 +1606,10 @@
1636
1606
  describeObjectForErrorMessage(parent, parentPropertyName)
1637
1607
  );
1638
1608
  request.pendingChunks++;
1639
- parentPropertyName = request.nextChunkId++;
1640
- parent = encodeReferenceChunk(
1641
- request,
1642
- parentPropertyName,
1643
- "$S" + elementReference
1644
- );
1645
- request.completedImportChunks.push(parent);
1646
- task.set(value, parentPropertyName);
1647
- return serializeByValueID(parentPropertyName);
1609
+ _writtenObjects = request.nextChunkId++;
1610
+ emitSymbolChunk(request, _writtenObjects, elementReference);
1611
+ task.set(value, _writtenObjects);
1612
+ return serializeByValueID(_writtenObjects);
1648
1613
  }
1649
1614
  if ("bigint" === typeof value) return "$n" + value.toString(10);
1650
1615
  throw Error(
@@ -1654,11 +1619,21 @@
1654
1619
  describeObjectForErrorMessage(parent, parentPropertyName)
1655
1620
  );
1656
1621
  }
1657
- function logRecoverableError(request, error) {
1622
+ function logRecoverableError(request, error, task) {
1658
1623
  var prevRequest = currentRequest;
1659
1624
  currentRequest = null;
1660
1625
  try {
1661
- var errorDigest = requestStorage.run(void 0, request.onError, error);
1626
+ var onError = request.onError;
1627
+ var errorDigest =
1628
+ null !== task
1629
+ ? requestStorage.run(
1630
+ void 0,
1631
+ callWithDebugContextInDEV,
1632
+ task,
1633
+ onError,
1634
+ error
1635
+ )
1636
+ : requestStorage.run(void 0, onError, error);
1662
1637
  } finally {
1663
1638
  currentRequest = prevRequest;
1664
1639
  }
@@ -1706,6 +1681,10 @@
1706
1681
  id = id.toString(16) + ":E" + stringify(digest) + "\n";
1707
1682
  request.completedErrorChunks.push(id);
1708
1683
  }
1684
+ function emitSymbolChunk(request, id, name) {
1685
+ id = encodeReferenceChunk(request, id, "$S" + name);
1686
+ request.completedImportChunks.push(id);
1687
+ }
1709
1688
  function emitModelChunk(request, id, json) {
1710
1689
  id = id.toString(16) + ":" + json + "\n";
1711
1690
  request.completedRegularChunks.push(id);
@@ -1853,12 +1832,11 @@
1853
1832
  if ("symbol" === typeof value) {
1854
1833
  counter = request.writtenSymbols.get(value);
1855
1834
  if (void 0 !== counter) return serializeByValueID(counter);
1856
- counter = value.description;
1835
+ value = value.description;
1857
1836
  request.pendingChunks++;
1858
- value = request.nextChunkId++;
1859
- counter = encodeReferenceChunk(request, value, "$S" + counter);
1860
- request.completedImportChunks.push(counter);
1861
- return serializeByValueID(value);
1837
+ counter = request.nextChunkId++;
1838
+ emitSymbolChunk(request, counter, value);
1839
+ return serializeByValueID(counter);
1862
1840
  }
1863
1841
  return "bigint" === typeof value
1864
1842
  ? "$n" + value.toString(10)
@@ -1989,7 +1967,7 @@
1989
1967
  } else {
1990
1968
  request.abortableTasks.delete(task);
1991
1969
  task.status = 4;
1992
- var digest = logRecoverableError(request, x);
1970
+ var digest = logRecoverableError(request, x, task);
1993
1971
  emitErrorChunk(request, task.id, digest, x);
1994
1972
  }
1995
1973
  } finally {
@@ -2019,7 +1997,8 @@
2019
1997
  null !== request.destination &&
2020
1998
  flushCompletedChunks(request, request.destination);
2021
1999
  } catch (error$2) {
2022
- logRecoverableError(request, error$2), fatalError(request, error$2);
2000
+ logRecoverableError(request, error$2, null),
2001
+ fatalError(request, error$2);
2023
2002
  } finally {
2024
2003
  (ReactSharedInternalsServer.H = prevDispatcher),
2025
2004
  (currentRequest$1 = null),
@@ -2115,7 +2094,8 @@
2115
2094
  try {
2116
2095
  flushCompletedChunks(request, destination);
2117
2096
  } catch (error$3) {
2118
- logRecoverableError(request, error$3), fatalError(request, error$3);
2097
+ logRecoverableError(request, error$3, null),
2098
+ fatalError(request, error$3);
2119
2099
  }
2120
2100
  }
2121
2101
  }
@@ -2137,7 +2117,7 @@
2137
2117
  "function" === typeof reason.then
2138
2118
  ? Error("The render was aborted by the server with a promise.")
2139
2119
  : reason,
2140
- digest = logRecoverableError(request, error);
2120
+ digest = logRecoverableError(request, error, null);
2141
2121
  emitErrorChunk(request, errorId, digest, error);
2142
2122
  abortableTasks.forEach(function (task) {
2143
2123
  if (5 !== task.status) {
@@ -2167,7 +2147,8 @@
2167
2147
  null !== request.destination &&
2168
2148
  flushCompletedChunks(request, request.destination);
2169
2149
  } catch (error$4) {
2170
- logRecoverableError(request, error$4), fatalError(request, error$4);
2150
+ logRecoverableError(request, error$4, null),
2151
+ fatalError(request, error$4);
2171
2152
  }
2172
2153
  }
2173
2154
  function resolveServerReference(bundlerConfig, id) {
@@ -3240,8 +3221,9 @@
3240
3221
  var owner = componentStorage.getStore();
3241
3222
  return owner ? owner : null;
3242
3223
  }
3243
- },
3244
- isArrayImpl = Array.isArray,
3224
+ };
3225
+ new ("function" === typeof WeakMap ? WeakMap : Map)();
3226
+ var isArrayImpl = Array.isArray,
3245
3227
  getPrototypeOf = Object.getPrototypeOf,
3246
3228
  jsxPropsParents = new WeakMap(),
3247
3229
  jsxChildrenParents = new WeakMap(),
@@ -3371,12 +3353,12 @@
3371
3353
  "React doesn't accept base64 encoded file uploads because we don't expect form data passed from a browser to ever encode data that way. If that's the wrong assumption, we can easily fix it."
3372
3354
  );
3373
3355
  pendingFiles++;
3374
- var JSCompiler_object_inline_chunks_156 = [];
3356
+ var JSCompiler_object_inline_chunks_124 = [];
3375
3357
  value.on("data", function (chunk) {
3376
- JSCompiler_object_inline_chunks_156.push(chunk);
3358
+ JSCompiler_object_inline_chunks_124.push(chunk);
3377
3359
  });
3378
3360
  value.on("end", function () {
3379
- var blob = new Blob(JSCompiler_object_inline_chunks_156, {
3361
+ var blob = new Blob(JSCompiler_object_inline_chunks_124, {
3380
3362
  type: mimeType
3381
3363
  });
3382
3364
  response._formData.append(name, blob, filename);