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.
- package/cjs/react-server-dom-webpack-client.browser.development.js +45 -41
- package/cjs/react-server-dom-webpack-client.edge.development.js +45 -41
- package/cjs/react-server-dom-webpack-client.node.development.js +45 -41
- package/cjs/react-server-dom-webpack-client.node.unbundled.development.js +45 -41
- package/cjs/react-server-dom-webpack-server.browser.development.js +273 -299
- package/cjs/react-server-dom-webpack-server.browser.production.js +20 -19
- package/cjs/react-server-dom-webpack-server.edge.development.js +283 -301
- package/cjs/react-server-dom-webpack-server.edge.production.js +20 -19
- package/cjs/react-server-dom-webpack-server.node.development.js +284 -302
- package/cjs/react-server-dom-webpack-server.node.production.js +22 -22
- package/cjs/react-server-dom-webpack-server.node.unbundled.development.js +284 -302
- package/cjs/react-server-dom-webpack-server.node.unbundled.production.js +22 -22
- package/package.json +3 -3
@@ -303,6 +303,24 @@
|
|
303
303
|
if (!(object[i] in ObjectPrototype)) return !1;
|
304
304
|
return !0;
|
305
305
|
}
|
306
|
+
function isSimpleObject(object) {
|
307
|
+
if (!isObjectPrototype(getPrototypeOf(object))) return !1;
|
308
|
+
for (
|
309
|
+
var names = Object.getOwnPropertyNames(object), i = 0;
|
310
|
+
i < names.length;
|
311
|
+
i++
|
312
|
+
) {
|
313
|
+
var descriptor = Object.getOwnPropertyDescriptor(object, names[i]);
|
314
|
+
if (
|
315
|
+
!descriptor ||
|
316
|
+
(!descriptor.enumerable &&
|
317
|
+
(("key" !== names[i] && "ref" !== names[i]) ||
|
318
|
+
"function" !== typeof descriptor.get))
|
319
|
+
)
|
320
|
+
return !1;
|
321
|
+
}
|
322
|
+
return !0;
|
323
|
+
}
|
306
324
|
function objectName(object) {
|
307
325
|
return Object.prototype.toString
|
308
326
|
.call(object)
|
@@ -471,6 +489,9 @@
|
|
471
489
|
error += "\n at " + structuredStackTrace[i].toString();
|
472
490
|
return error;
|
473
491
|
}
|
492
|
+
function getCurrentStackInDEV() {
|
493
|
+
return "";
|
494
|
+
}
|
474
495
|
function defaultErrorHandler(error) {
|
475
496
|
console.error(error);
|
476
497
|
}
|
@@ -492,6 +513,7 @@
|
|
492
513
|
"Currently React only supports one RSC renderer at a time."
|
493
514
|
);
|
494
515
|
ReactSharedInternalsServer.A = DefaultAsyncDispatcher;
|
516
|
+
ReactSharedInternalsServer.getCurrentStack = getCurrentStackInDEV;
|
495
517
|
var abortSet = new Set(),
|
496
518
|
pingedTasks = [],
|
497
519
|
hints = new Set();
|
@@ -553,7 +575,7 @@
|
|
553
575
|
);
|
554
576
|
case "rejected":
|
555
577
|
task = thenable.reason;
|
556
|
-
var digest = logRecoverableError(request, task);
|
578
|
+
var digest = logRecoverableError(request, task, null);
|
557
579
|
emitErrorChunk(request, newTask.id, digest, task);
|
558
580
|
return newTask.id;
|
559
581
|
default:
|
@@ -586,7 +608,7 @@
|
|
586
608
|
},
|
587
609
|
function (reason) {
|
588
610
|
newTask.status = 4;
|
589
|
-
var _digest = logRecoverableError(request, reason);
|
611
|
+
var _digest = logRecoverableError(request, reason, newTask);
|
590
612
|
emitErrorChunk(request, newTask.id, _digest, reason);
|
591
613
|
request.abortableTasks.delete(newTask);
|
592
614
|
enqueueFlush(request);
|
@@ -618,7 +640,7 @@
|
|
618
640
|
if (!aborted) {
|
619
641
|
aborted = !0;
|
620
642
|
request.abortListeners.delete(error);
|
621
|
-
var digest = logRecoverableError(request, reason);
|
643
|
+
var digest = logRecoverableError(request, reason, streamTask);
|
622
644
|
emitErrorChunk(request, streamTask.id, digest, reason);
|
623
645
|
enqueueFlush(request);
|
624
646
|
reader.cancel(reason).then(error, error);
|
@@ -689,7 +711,7 @@
|
|
689
711
|
if (!aborted) {
|
690
712
|
aborted = !0;
|
691
713
|
request.abortListeners.delete(error);
|
692
|
-
var digest = logRecoverableError(request, reason);
|
714
|
+
var digest = logRecoverableError(request, reason, streamTask);
|
693
715
|
emitErrorChunk(request, streamTask.id, digest, reason);
|
694
716
|
enqueueFlush(request);
|
695
717
|
"function" === typeof iterator.throw &&
|
@@ -769,32 +791,41 @@
|
|
769
791
|
var init = lazy._init;
|
770
792
|
return init(lazy._payload);
|
771
793
|
}
|
772
|
-
function
|
773
|
-
|
774
|
-
|
775
|
-
|
776
|
-
|
777
|
-
|
778
|
-
|
779
|
-
|
780
|
-
|
781
|
-
|
782
|
-
stack = task.thenableState;
|
794
|
+
function callWithDebugContextInDEV(task, callback, arg) {
|
795
|
+
currentOwner = { env: task.environmentName, owner: task.debugOwner };
|
796
|
+
try {
|
797
|
+
return callback(arg);
|
798
|
+
} finally {
|
799
|
+
currentOwner = null;
|
800
|
+
}
|
801
|
+
}
|
802
|
+
function renderFunctionComponent(request, task, key, Component, props) {
|
803
|
+
var prevThenableState = task.thenableState;
|
783
804
|
task.thenableState = null;
|
784
805
|
if (null === debugID) return outlineTask(request, task);
|
785
|
-
if (null !==
|
806
|
+
if (null !== prevThenableState)
|
807
|
+
var componentDebugInfo = prevThenableState._componentDebugInfo;
|
786
808
|
else {
|
787
|
-
var componentDebugID = debugID
|
788
|
-
|
789
|
-
|
809
|
+
var componentDebugID = debugID;
|
810
|
+
componentDebugInfo = Component.displayName || Component.name || "";
|
811
|
+
var componentEnv = request.environmentName();
|
790
812
|
request.pendingChunks++;
|
791
|
-
|
792
|
-
|
793
|
-
|
813
|
+
componentDebugInfo = {
|
814
|
+
name: componentDebugInfo,
|
815
|
+
env: componentEnv,
|
816
|
+
owner: task.debugOwner
|
817
|
+
};
|
818
|
+
outlineModel(request, componentDebugInfo);
|
819
|
+
emitDebugChunk(request, componentDebugID, componentDebugInfo);
|
794
820
|
task.environmentName = componentEnv;
|
795
821
|
}
|
796
|
-
prepareToUseHooksForComponent(
|
797
|
-
props = callComponentInDEV(
|
822
|
+
prepareToUseHooksForComponent(prevThenableState, componentDebugInfo);
|
823
|
+
props = callComponentInDEV(
|
824
|
+
Component,
|
825
|
+
props,
|
826
|
+
componentDebugInfo,
|
827
|
+
task.debugTask
|
828
|
+
);
|
798
829
|
if (1 === request.status) throw AbortSigil;
|
799
830
|
if (
|
800
831
|
"object" === typeof props &&
|
@@ -802,8 +833,8 @@
|
|
802
833
|
props.$$typeof !== CLIENT_REFERENCE_TAG$1
|
803
834
|
) {
|
804
835
|
if ("function" === typeof props.then) {
|
805
|
-
|
806
|
-
|
836
|
+
prevThenableState = props;
|
837
|
+
prevThenableState.then(
|
807
838
|
function (resolvedValue) {
|
808
839
|
"object" === typeof resolvedValue &&
|
809
840
|
null !== resolvedValue &&
|
@@ -812,7 +843,8 @@
|
|
812
843
|
},
|
813
844
|
function () {}
|
814
845
|
);
|
815
|
-
if ("fulfilled" ===
|
846
|
+
if ("fulfilled" === prevThenableState.status)
|
847
|
+
return prevThenableState.value;
|
816
848
|
props = createLazyWrapperAroundWakeable(props);
|
817
849
|
}
|
818
850
|
var iteratorFn = getIteratorFn(props);
|
@@ -825,9 +857,11 @@
|
|
825
857
|
Object.prototype.toString.call(Component) &&
|
826
858
|
"[object Generator]" ===
|
827
859
|
Object.prototype.toString.call(iterableChild)) ||
|
828
|
-
|
829
|
-
|
830
|
-
|
860
|
+
callWithDebugContextInDEV(task, function () {
|
861
|
+
error$jscomp$0(
|
862
|
+
"Returning an Iterator from a Server Component is not supported since it cannot be looped over more than once. "
|
863
|
+
);
|
864
|
+
});
|
831
865
|
return iterator;
|
832
866
|
});
|
833
867
|
props._debugInfo = iterableChild._debugInfo;
|
@@ -846,22 +880,25 @@
|
|
846
880
|
Object.prototype.toString.call(Component) &&
|
847
881
|
"[object AsyncGenerator]" ===
|
848
882
|
Object.prototype.toString.call(_iterableChild)) ||
|
849
|
-
|
850
|
-
|
851
|
-
|
883
|
+
callWithDebugContextInDEV(task, function () {
|
884
|
+
error$jscomp$0(
|
885
|
+
"Returning an AsyncIterator from a Server Component is not supported since it cannot be looped over more than once. "
|
886
|
+
);
|
887
|
+
});
|
852
888
|
return iterator;
|
853
889
|
});
|
854
890
|
props._debugInfo = _iterableChild._debugInfo;
|
855
891
|
}
|
856
892
|
}
|
857
|
-
|
858
|
-
|
893
|
+
prevThenableState = task.keyPath;
|
894
|
+
componentDebugID = task.implicitSlot;
|
859
895
|
null !== key
|
860
|
-
? (task.keyPath =
|
861
|
-
|
896
|
+
? (task.keyPath =
|
897
|
+
null === prevThenableState ? key : prevThenableState + "," + key)
|
898
|
+
: null === prevThenableState && (task.implicitSlot = !0);
|
862
899
|
request = renderModelDestructive(request, task, emptyRoot, "", props);
|
863
|
-
task.keyPath =
|
864
|
-
task.implicitSlot =
|
900
|
+
task.keyPath = prevThenableState;
|
901
|
+
task.implicitSlot = componentDebugID;
|
865
902
|
return request;
|
866
903
|
}
|
867
904
|
function renderFragment(request, task, children) {
|
@@ -892,6 +929,21 @@
|
|
892
929
|
}
|
893
930
|
return children;
|
894
931
|
}
|
932
|
+
function renderAsyncFragment(request, task, children, getAsyncIterator) {
|
933
|
+
if (null !== task.keyPath)
|
934
|
+
return (
|
935
|
+
(request = [
|
936
|
+
REACT_ELEMENT_TYPE,
|
937
|
+
REACT_FRAGMENT_TYPE,
|
938
|
+
task.keyPath,
|
939
|
+
{ children: children },
|
940
|
+
null
|
941
|
+
]),
|
942
|
+
task.implicitSlot ? [request] : request
|
943
|
+
);
|
944
|
+
getAsyncIterator = getAsyncIterator.call(children);
|
945
|
+
return serializeAsyncIterable(request, task, children, getAsyncIterator);
|
946
|
+
}
|
895
947
|
function outlineTask(request, task) {
|
896
948
|
task = createTask(
|
897
949
|
request,
|
@@ -905,17 +957,7 @@
|
|
905
957
|
? serializeByValueID(task.id)
|
906
958
|
: serializeLazyID(task.id);
|
907
959
|
}
|
908
|
-
function renderElement(
|
909
|
-
request,
|
910
|
-
task,
|
911
|
-
type,
|
912
|
-
key,
|
913
|
-
ref,
|
914
|
-
props,
|
915
|
-
owner,
|
916
|
-
stack,
|
917
|
-
debugTask
|
918
|
-
) {
|
960
|
+
function renderElement(request, task, type, key, ref, props) {
|
919
961
|
if (null !== ref && void 0 !== ref)
|
920
962
|
throw Error(
|
921
963
|
"Refs cannot be used in Server Components, nor passed to Client Components."
|
@@ -929,19 +971,10 @@
|
|
929
971
|
type.$$typeof !== CLIENT_REFERENCE_TAG$1 &&
|
930
972
|
type.$$typeof !== TEMPORARY_REFERENCE_TAG
|
931
973
|
)
|
932
|
-
return renderFunctionComponent(
|
933
|
-
request,
|
934
|
-
task,
|
935
|
-
key,
|
936
|
-
type,
|
937
|
-
props,
|
938
|
-
owner,
|
939
|
-
stack,
|
940
|
-
debugTask
|
941
|
-
);
|
974
|
+
return renderFunctionComponent(request, task, key, type, props);
|
942
975
|
if (type === REACT_FRAGMENT_TYPE && null === key)
|
943
976
|
return (
|
944
|
-
(
|
977
|
+
(type = task.implicitSlot),
|
945
978
|
null === task.keyPath && (task.implicitSlot = !0),
|
946
979
|
(props = renderModelDestructive(
|
947
980
|
request,
|
@@ -950,7 +983,7 @@
|
|
950
983
|
"",
|
951
984
|
props.children
|
952
985
|
)),
|
953
|
-
(task.implicitSlot =
|
986
|
+
(task.implicitSlot = type),
|
954
987
|
props
|
955
988
|
);
|
956
989
|
if (
|
@@ -962,40 +995,17 @@
|
|
962
995
|
case REACT_LAZY_TYPE:
|
963
996
|
type = callLazyInitInDEV(type);
|
964
997
|
if (1 === request.status) throw AbortSigil;
|
965
|
-
return renderElement(
|
966
|
-
request,
|
967
|
-
task,
|
968
|
-
type,
|
969
|
-
key,
|
970
|
-
ref,
|
971
|
-
props,
|
972
|
-
owner,
|
973
|
-
stack,
|
974
|
-
debugTask
|
975
|
-
);
|
998
|
+
return renderElement(request, task, type, key, ref, props);
|
976
999
|
case REACT_FORWARD_REF_TYPE:
|
977
1000
|
return renderFunctionComponent(
|
978
1001
|
request,
|
979
1002
|
task,
|
980
1003
|
key,
|
981
1004
|
type.render,
|
982
|
-
props
|
983
|
-
owner,
|
984
|
-
stack,
|
985
|
-
debugTask
|
1005
|
+
props
|
986
1006
|
);
|
987
1007
|
case REACT_MEMO_TYPE:
|
988
|
-
return renderElement(
|
989
|
-
request,
|
990
|
-
task,
|
991
|
-
type.type,
|
992
|
-
key,
|
993
|
-
ref,
|
994
|
-
props,
|
995
|
-
owner,
|
996
|
-
stack,
|
997
|
-
debugTask
|
998
|
-
);
|
1008
|
+
return renderElement(request, task, type.type, key, ref, props);
|
999
1009
|
case REACT_ELEMENT_TYPE:
|
1000
1010
|
type._store.validated = 1;
|
1001
1011
|
}
|
@@ -1004,7 +1014,7 @@
|
|
1004
1014
|
null === request
|
1005
1015
|
? (request = key)
|
1006
1016
|
: null !== key && (request = key + "," + request);
|
1007
|
-
props = [REACT_ELEMENT_TYPE, type, request, props,
|
1017
|
+
props = [REACT_ELEMENT_TYPE, type, request, props, task.debugOwner];
|
1008
1018
|
task = task.implicitSlot && null !== request ? [props] : props;
|
1009
1019
|
return task;
|
1010
1020
|
}
|
@@ -1035,95 +1045,30 @@
|
|
1035
1045
|
return pingTask(request, task);
|
1036
1046
|
},
|
1037
1047
|
toJSON: function (parentPropertyName, value) {
|
1038
|
-
var
|
1048
|
+
var parent = this,
|
1049
|
+
originalValue = parent[parentPropertyName];
|
1039
1050
|
"object" !== typeof originalValue ||
|
1040
1051
|
originalValue === value ||
|
1041
1052
|
originalValue instanceof Date ||
|
1042
|
-
(
|
1043
|
-
|
1044
|
-
?
|
1045
|
-
|
1046
|
-
|
1047
|
-
|
1048
|
-
|
1053
|
+
callWithDebugContextInDEV(task, function () {
|
1054
|
+
"Object" !== objectName(originalValue)
|
1055
|
+
? "string" === typeof jsxChildrenParents.get(parent)
|
1056
|
+
? error$jscomp$0(
|
1057
|
+
"%s objects cannot be rendered as text children. Try formatting it using toString().%s",
|
1058
|
+
objectName(originalValue),
|
1059
|
+
describeObjectForErrorMessage(parent, parentPropertyName)
|
1060
|
+
)
|
1061
|
+
: error$jscomp$0(
|
1062
|
+
"Only plain objects can be passed to Client Components from Server Components. %s objects are not supported.%s",
|
1063
|
+
objectName(originalValue),
|
1064
|
+
describeObjectForErrorMessage(parent, parentPropertyName)
|
1065
|
+
)
|
1049
1066
|
: error$jscomp$0(
|
1050
|
-
"Only plain objects can be passed to Client Components from Server Components.
|
1051
|
-
|
1052
|
-
|
1053
|
-
|
1054
|
-
|
1055
|
-
"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",
|
1056
|
-
describeObjectForErrorMessage(this, parentPropertyName)
|
1057
|
-
));
|
1058
|
-
originalValue = task;
|
1059
|
-
var prevKeyPath = originalValue.keyPath,
|
1060
|
-
prevImplicitSlot = originalValue.implicitSlot;
|
1061
|
-
try {
|
1062
|
-
var JSCompiler_inline_result = renderModelDestructive(
|
1063
|
-
request,
|
1064
|
-
originalValue,
|
1065
|
-
this,
|
1066
|
-
parentPropertyName,
|
1067
|
-
value
|
1068
|
-
);
|
1069
|
-
} catch (thrownValue) {
|
1070
|
-
if (
|
1071
|
-
((parentPropertyName = originalValue.model),
|
1072
|
-
(parentPropertyName =
|
1073
|
-
"object" === typeof parentPropertyName &&
|
1074
|
-
null !== parentPropertyName &&
|
1075
|
-
(parentPropertyName.$$typeof === REACT_ELEMENT_TYPE ||
|
1076
|
-
parentPropertyName.$$typeof === REACT_LAZY_TYPE)),
|
1077
|
-
(value =
|
1078
|
-
thrownValue === SuspenseException
|
1079
|
-
? getSuspendedThenable()
|
1080
|
-
: thrownValue),
|
1081
|
-
"object" === typeof value &&
|
1082
|
-
null !== value &&
|
1083
|
-
"function" === typeof value.then)
|
1084
|
-
)
|
1085
|
-
if (1 === request.status)
|
1086
|
-
(originalValue.status = 3),
|
1087
|
-
(originalValue = request.fatalError),
|
1088
|
-
(JSCompiler_inline_result = parentPropertyName
|
1089
|
-
? serializeLazyID(originalValue)
|
1090
|
-
: serializeByValueID(originalValue));
|
1091
|
-
else {
|
1092
|
-
JSCompiler_inline_result = createTask(
|
1093
|
-
request,
|
1094
|
-
originalValue.model,
|
1095
|
-
originalValue.keyPath,
|
1096
|
-
originalValue.implicitSlot,
|
1097
|
-
request.abortableTasks
|
1098
|
-
);
|
1099
|
-
var ping = JSCompiler_inline_result.ping;
|
1100
|
-
value.then(ping, ping);
|
1101
|
-
JSCompiler_inline_result.thenableState =
|
1102
|
-
getThenableStateAfterSuspending();
|
1103
|
-
originalValue.keyPath = prevKeyPath;
|
1104
|
-
originalValue.implicitSlot = prevImplicitSlot;
|
1105
|
-
JSCompiler_inline_result = parentPropertyName
|
1106
|
-
? serializeLazyID(JSCompiler_inline_result.id)
|
1107
|
-
: serializeByValueID(JSCompiler_inline_result.id);
|
1108
|
-
}
|
1109
|
-
else
|
1110
|
-
thrownValue === AbortSigil
|
1111
|
-
? ((originalValue.status = 3),
|
1112
|
-
(originalValue = request.fatalError),
|
1113
|
-
(JSCompiler_inline_result = parentPropertyName
|
1114
|
-
? serializeLazyID(originalValue)
|
1115
|
-
: serializeByValueID(originalValue)))
|
1116
|
-
: ((originalValue.keyPath = prevKeyPath),
|
1117
|
-
(originalValue.implicitSlot = prevImplicitSlot),
|
1118
|
-
request.pendingChunks++,
|
1119
|
-
(originalValue = request.nextChunkId++),
|
1120
|
-
(prevKeyPath = logRecoverableError(request, value)),
|
1121
|
-
emitErrorChunk(request, originalValue, prevKeyPath, value),
|
1122
|
-
(JSCompiler_inline_result = parentPropertyName
|
1123
|
-
? serializeLazyID(originalValue)
|
1124
|
-
: serializeByValueID(originalValue)));
|
1125
|
-
}
|
1126
|
-
return JSCompiler_inline_result;
|
1067
|
+
"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",
|
1068
|
+
describeObjectForErrorMessage(parent, parentPropertyName)
|
1069
|
+
);
|
1070
|
+
});
|
1071
|
+
return renderModel(request, task, parent, parentPropertyName, value);
|
1127
1072
|
},
|
1128
1073
|
thenableState: null
|
1129
1074
|
};
|
@@ -1204,7 +1149,7 @@
|
|
1204
1149
|
return (
|
1205
1150
|
request.pendingChunks++,
|
1206
1151
|
(parent = request.nextChunkId++),
|
1207
|
-
(parentPropertyName = logRecoverableError(request, x)),
|
1152
|
+
(parentPropertyName = logRecoverableError(request, x, null)),
|
1208
1153
|
emitErrorChunk(request, parent, parentPropertyName, x),
|
1209
1154
|
serializeByValueID(parent)
|
1210
1155
|
);
|
@@ -1215,6 +1160,19 @@
|
|
1215
1160
|
retryTask(request, value);
|
1216
1161
|
return value.id;
|
1217
1162
|
}
|
1163
|
+
function serializeServerReference(request, serverReference) {
|
1164
|
+
var writtenServerReferences = request.writtenServerReferences,
|
1165
|
+
existingId = writtenServerReferences.get(serverReference);
|
1166
|
+
if (void 0 !== existingId) return "$F" + existingId.toString(16);
|
1167
|
+
existingId = serverReference.$$bound;
|
1168
|
+
existingId = {
|
1169
|
+
id: serverReference.$$id,
|
1170
|
+
bound: existingId ? Promise.resolve(existingId) : null
|
1171
|
+
};
|
1172
|
+
request = outlineModel(request, existingId);
|
1173
|
+
writtenServerReferences.set(serverReference, request);
|
1174
|
+
return "$F" + request.toString(16);
|
1175
|
+
}
|
1218
1176
|
function serializeLargeTextString(request, text) {
|
1219
1177
|
request.pendingChunks++;
|
1220
1178
|
var textId = request.nextChunkId++;
|
@@ -1255,7 +1213,7 @@
|
|
1255
1213
|
if (!aborted) {
|
1256
1214
|
aborted = !0;
|
1257
1215
|
request.abortListeners.delete(error);
|
1258
|
-
var digest = logRecoverableError(request, reason);
|
1216
|
+
var digest = logRecoverableError(request, reason, newTask);
|
1259
1217
|
emitErrorChunk(request, newTask.id, digest, reason);
|
1260
1218
|
request.abortableTasks.delete(newTask);
|
1261
1219
|
enqueueFlush(request);
|
@@ -1270,6 +1228,66 @@
|
|
1270
1228
|
reader.read().then(progress).catch(error);
|
1271
1229
|
return "$B" + newTask.id.toString(16);
|
1272
1230
|
}
|
1231
|
+
function renderModel(request, task, parent, key, value) {
|
1232
|
+
var prevKeyPath = task.keyPath,
|
1233
|
+
prevImplicitSlot = task.implicitSlot;
|
1234
|
+
try {
|
1235
|
+
return renderModelDestructive(request, task, parent, key, value);
|
1236
|
+
} catch (thrownValue) {
|
1237
|
+
parent = task.model;
|
1238
|
+
parent =
|
1239
|
+
"object" === typeof parent &&
|
1240
|
+
null !== parent &&
|
1241
|
+
(parent.$$typeof === REACT_ELEMENT_TYPE ||
|
1242
|
+
parent.$$typeof === REACT_LAZY_TYPE);
|
1243
|
+
key =
|
1244
|
+
thrownValue === SuspenseException
|
1245
|
+
? getSuspendedThenable()
|
1246
|
+
: thrownValue;
|
1247
|
+
if (
|
1248
|
+
"object" === typeof key &&
|
1249
|
+
null !== key &&
|
1250
|
+
"function" === typeof key.then
|
1251
|
+
) {
|
1252
|
+
if (1 === request.status)
|
1253
|
+
return (
|
1254
|
+
(task.status = 3),
|
1255
|
+
(task = request.fatalError),
|
1256
|
+
parent ? serializeLazyID(task) : serializeByValueID(task)
|
1257
|
+
);
|
1258
|
+
request = createTask(
|
1259
|
+
request,
|
1260
|
+
task.model,
|
1261
|
+
task.keyPath,
|
1262
|
+
task.implicitSlot,
|
1263
|
+
request.abortableTasks
|
1264
|
+
);
|
1265
|
+
value = request.ping;
|
1266
|
+
key.then(value, value);
|
1267
|
+
request.thenableState = getThenableStateAfterSuspending();
|
1268
|
+
task.keyPath = prevKeyPath;
|
1269
|
+
task.implicitSlot = prevImplicitSlot;
|
1270
|
+
return parent
|
1271
|
+
? serializeLazyID(request.id)
|
1272
|
+
: serializeByValueID(request.id);
|
1273
|
+
}
|
1274
|
+
if (thrownValue === AbortSigil)
|
1275
|
+
return (
|
1276
|
+
(task.status = 3),
|
1277
|
+
(task = request.fatalError),
|
1278
|
+
parent ? serializeLazyID(task) : serializeByValueID(task)
|
1279
|
+
);
|
1280
|
+
task.keyPath = prevKeyPath;
|
1281
|
+
task.implicitSlot = prevImplicitSlot;
|
1282
|
+
request.pendingChunks++;
|
1283
|
+
prevKeyPath = request.nextChunkId++;
|
1284
|
+
task = logRecoverableError(request, key, task);
|
1285
|
+
emitErrorChunk(request, prevKeyPath, task, key);
|
1286
|
+
return parent
|
1287
|
+
? serializeLazyID(prevKeyPath)
|
1288
|
+
: serializeByValueID(prevKeyPath);
|
1289
|
+
}
|
1290
|
+
}
|
1273
1291
|
function renderModelDestructive(
|
1274
1292
|
request,
|
1275
1293
|
task,
|
@@ -1292,48 +1310,47 @@
|
|
1292
1310
|
else return _existingReference;
|
1293
1311
|
else
|
1294
1312
|
-1 === parentPropertyName.indexOf(":") &&
|
1295
|
-
((
|
1296
|
-
void 0 !==
|
1297
|
-
((elementReference =
|
1313
|
+
((_existingReference = _writtenObjects.get(parent)),
|
1314
|
+
void 0 !== _existingReference &&
|
1315
|
+
((elementReference =
|
1316
|
+
_existingReference + ":" + parentPropertyName),
|
1298
1317
|
_writtenObjects.set(value, elementReference)));
|
1299
1318
|
}
|
1300
|
-
if ((
|
1319
|
+
if ((_existingReference = value._debugInfo)) {
|
1301
1320
|
if (null === debugID) return outlineTask(request, task);
|
1302
|
-
forwardDebugInfo(request, debugID,
|
1321
|
+
forwardDebugInfo(request, debugID, _existingReference);
|
1303
1322
|
}
|
1304
|
-
|
1305
|
-
|
1306
|
-
|
1323
|
+
_existingReference = value.props;
|
1324
|
+
var refProp = _existingReference.ref;
|
1325
|
+
task.debugOwner = value._owner;
|
1326
|
+
request = renderElement(
|
1307
1327
|
request,
|
1308
1328
|
task,
|
1309
1329
|
value.type,
|
1310
1330
|
value.key,
|
1311
|
-
void 0 !==
|
1312
|
-
|
1313
|
-
value._owner,
|
1314
|
-
null,
|
1315
|
-
null
|
1331
|
+
void 0 !== refProp ? refProp : null,
|
1332
|
+
_existingReference
|
1316
1333
|
);
|
1317
|
-
"object" === typeof
|
1318
|
-
null !==
|
1334
|
+
"object" === typeof request &&
|
1335
|
+
null !== request &&
|
1319
1336
|
null !== elementReference &&
|
1320
|
-
(_writtenObjects.has(
|
1321
|
-
_writtenObjects.set(
|
1322
|
-
return
|
1337
|
+
(_writtenObjects.has(request) ||
|
1338
|
+
_writtenObjects.set(request, elementReference));
|
1339
|
+
return request;
|
1323
1340
|
case REACT_LAZY_TYPE:
|
1324
1341
|
task.thenableState = null;
|
1325
|
-
|
1342
|
+
elementReference = callLazyInitInDEV(value);
|
1326
1343
|
if (1 === request.status) throw AbortSigil;
|
1327
|
-
if ((
|
1344
|
+
if ((_writtenObjects = value._debugInfo)) {
|
1328
1345
|
if (null === debugID) return outlineTask(request, task);
|
1329
|
-
forwardDebugInfo(request, debugID,
|
1346
|
+
forwardDebugInfo(request, debugID, _writtenObjects);
|
1330
1347
|
}
|
1331
1348
|
return renderModelDestructive(
|
1332
1349
|
request,
|
1333
1350
|
task,
|
1334
1351
|
emptyRoot,
|
1335
1352
|
"",
|
1336
|
-
|
1353
|
+
elementReference
|
1337
1354
|
);
|
1338
1355
|
case REACT_LEGACY_ELEMENT_TYPE:
|
1339
1356
|
throw Error(
|
@@ -1428,13 +1445,11 @@
|
|
1428
1445
|
return serializeBlob(request, value);
|
1429
1446
|
if ((elementReference = getIteratorFn(value)))
|
1430
1447
|
return (
|
1431
|
-
(
|
1432
|
-
|
1448
|
+
(elementReference = elementReference.call(value)),
|
1449
|
+
elementReference === value
|
1433
1450
|
? "$i" +
|
1434
|
-
outlineModel(request, Array.from(
|
1435
|
-
|
1436
|
-
)
|
1437
|
-
: renderFragment(request, task, Array.from(parentPropertyName))
|
1451
|
+
outlineModel(request, Array.from(elementReference)).toString(16)
|
1452
|
+
: renderFragment(request, task, Array.from(elementReference))
|
1438
1453
|
);
|
1439
1454
|
if (
|
1440
1455
|
"function" === typeof ReadableStream &&
|
@@ -1443,25 +1458,7 @@
|
|
1443
1458
|
return serializeReadableStream(request, task, value);
|
1444
1459
|
elementReference = value[ASYNC_ITERATOR];
|
1445
1460
|
if ("function" === typeof elementReference)
|
1446
|
-
return (
|
1447
|
-
null !== task.keyPath
|
1448
|
-
? ((value = [
|
1449
|
-
REACT_ELEMENT_TYPE,
|
1450
|
-
REACT_FRAGMENT_TYPE,
|
1451
|
-
task.keyPath,
|
1452
|
-
{ children: value },
|
1453
|
-
null
|
1454
|
-
]),
|
1455
|
-
(value = task.implicitSlot ? [value] : value))
|
1456
|
-
: ((parentPropertyName = elementReference.call(value)),
|
1457
|
-
(value = serializeAsyncIterable(
|
1458
|
-
request,
|
1459
|
-
task,
|
1460
|
-
value,
|
1461
|
-
parentPropertyName
|
1462
|
-
))),
|
1463
|
-
value
|
1464
|
-
);
|
1461
|
+
return renderAsyncFragment(request, task, value, elementReference);
|
1465
1462
|
request = getPrototypeOf(value);
|
1466
1463
|
if (
|
1467
1464
|
request !== ObjectPrototype &&
|
@@ -1481,43 +1478,30 @@
|
|
1481
1478
|
)
|
1482
1479
|
return { name: value.name, env: value.env, owner: value.owner };
|
1483
1480
|
if ("Object" !== objectName(value))
|
1484
|
-
|
1485
|
-
|
1486
|
-
|
1487
|
-
|
1488
|
-
|
1489
|
-
|
1490
|
-
|
1491
|
-
|
1492
|
-
|
1493
|
-
|
1494
|
-
|
1495
|
-
|
1496
|
-
|
1497
|
-
|
1498
|
-
|
1499
|
-
|
1500
|
-
|
1501
|
-
|
1502
|
-
|
1503
|
-
|
1504
|
-
|
1505
|
-
}
|
1506
|
-
request = !0;
|
1507
|
-
} else request = !1;
|
1508
|
-
request
|
1509
|
-
? Object.getOwnPropertySymbols &&
|
1510
|
-
((request = Object.getOwnPropertySymbols(value)),
|
1511
|
-
0 < request.length &&
|
1512
|
-
error$jscomp$0(
|
1513
|
-
"Only plain objects can be passed to Client Components from Server Components. Objects with symbol properties like %s are not supported.%s",
|
1514
|
-
request[0].description,
|
1515
|
-
describeObjectForErrorMessage(parent, parentPropertyName)
|
1516
|
-
))
|
1517
|
-
: error$jscomp$0(
|
1518
|
-
"Only plain objects can be passed to Client Components from Server Components. Classes or other objects with methods are not supported.%s",
|
1481
|
+
callWithDebugContextInDEV(task, function () {
|
1482
|
+
error$jscomp$0(
|
1483
|
+
"Only plain objects can be passed to Client Components from Server Components. %s objects are not supported.%s",
|
1484
|
+
objectName(value),
|
1485
|
+
describeObjectForErrorMessage(parent, parentPropertyName)
|
1486
|
+
);
|
1487
|
+
});
|
1488
|
+
else if (!isSimpleObject(value))
|
1489
|
+
callWithDebugContextInDEV(task, function () {
|
1490
|
+
error$jscomp$0(
|
1491
|
+
"Only plain objects can be passed to Client Components from Server Components. Classes or other objects with methods are not supported.%s",
|
1492
|
+
describeObjectForErrorMessage(parent, parentPropertyName)
|
1493
|
+
);
|
1494
|
+
});
|
1495
|
+
else if (Object.getOwnPropertySymbols) {
|
1496
|
+
var symbols = Object.getOwnPropertySymbols(value);
|
1497
|
+
0 < symbols.length &&
|
1498
|
+
callWithDebugContextInDEV(task, function () {
|
1499
|
+
error$jscomp$0(
|
1500
|
+
"Only plain objects can be passed to Client Components from Server Components. Objects with symbol properties like %s are not supported.%s",
|
1501
|
+
symbols[0].description,
|
1519
1502
|
describeObjectForErrorMessage(parent, parentPropertyName)
|
1520
1503
|
);
|
1504
|
+
});
|
1521
1505
|
}
|
1522
1506
|
return value;
|
1523
1507
|
}
|
@@ -1542,21 +1526,7 @@
|
|
1542
1526
|
value
|
1543
1527
|
);
|
1544
1528
|
if (value.$$typeof === SERVER_REFERENCE_TAG)
|
1545
|
-
return (
|
1546
|
-
(parentPropertyName = request.writtenServerReferences),
|
1547
|
-
(parent = parentPropertyName.get(value)),
|
1548
|
-
void 0 !== parent
|
1549
|
-
? (value = "$F" + parent.toString(16))
|
1550
|
-
: ((parent = value.$$bound),
|
1551
|
-
(parent = {
|
1552
|
-
id: value.$$id,
|
1553
|
-
bound: parent ? Promise.resolve(parent) : null
|
1554
|
-
}),
|
1555
|
-
(request = outlineModel(request, parent)),
|
1556
|
-
parentPropertyName.set(value, request),
|
1557
|
-
(value = "$F" + request.toString(16))),
|
1558
|
-
value
|
1559
|
-
);
|
1529
|
+
return serializeServerReference(request, value);
|
1560
1530
|
if (
|
1561
1531
|
void 0 !== request.temporaryReferences &&
|
1562
1532
|
((request = request.temporaryReferences.get(value)),
|
@@ -1578,12 +1548,12 @@
|
|
1578
1548
|
(jsxPropsParents.has(parent) && "children" === parentPropertyName)
|
1579
1549
|
)
|
1580
1550
|
throw (
|
1581
|
-
((
|
1551
|
+
((request = value.displayName || value.name || "Component"),
|
1582
1552
|
Error(
|
1583
1553
|
"Functions are not valid as a child of Client Components. This may happen if you return " +
|
1584
|
-
|
1554
|
+
request +
|
1585
1555
|
" instead of <" +
|
1586
|
-
|
1556
|
+
request +
|
1587
1557
|
" /> from render. Or maybe you meant to call this function rather than return it." +
|
1588
1558
|
describeObjectForErrorMessage(parent, parentPropertyName)
|
1589
1559
|
))
|
@@ -1606,15 +1576,10 @@
|
|
1606
1576
|
describeObjectForErrorMessage(parent, parentPropertyName)
|
1607
1577
|
);
|
1608
1578
|
request.pendingChunks++;
|
1609
|
-
|
1610
|
-
|
1611
|
-
|
1612
|
-
|
1613
|
-
"$S" + elementReference
|
1614
|
-
);
|
1615
|
-
request.completedImportChunks.push(parent);
|
1616
|
-
task.set(value, parentPropertyName);
|
1617
|
-
return serializeByValueID(parentPropertyName);
|
1579
|
+
_writtenObjects = request.nextChunkId++;
|
1580
|
+
emitSymbolChunk(request, _writtenObjects, elementReference);
|
1581
|
+
task.set(value, _writtenObjects);
|
1582
|
+
return serializeByValueID(_writtenObjects);
|
1618
1583
|
}
|
1619
1584
|
if ("bigint" === typeof value) return "$n" + value.toString(10);
|
1620
1585
|
throw Error(
|
@@ -1624,12 +1589,15 @@
|
|
1624
1589
|
describeObjectForErrorMessage(parent, parentPropertyName)
|
1625
1590
|
);
|
1626
1591
|
}
|
1627
|
-
function logRecoverableError(request, error) {
|
1592
|
+
function logRecoverableError(request, error, task) {
|
1628
1593
|
var prevRequest = currentRequest;
|
1629
1594
|
currentRequest = null;
|
1630
1595
|
try {
|
1631
1596
|
var onError = request.onError;
|
1632
|
-
var errorDigest =
|
1597
|
+
var errorDigest =
|
1598
|
+
null !== task
|
1599
|
+
? callWithDebugContextInDEV(task, onError, error)
|
1600
|
+
: onError(error);
|
1633
1601
|
} finally {
|
1634
1602
|
currentRequest = prevRequest;
|
1635
1603
|
}
|
@@ -1679,6 +1647,10 @@
|
|
1679
1647
|
id = stringToChunk(id);
|
1680
1648
|
request.completedErrorChunks.push(id);
|
1681
1649
|
}
|
1650
|
+
function emitSymbolChunk(request, id, name) {
|
1651
|
+
id = encodeReferenceChunk(request, id, "$S" + name);
|
1652
|
+
request.completedImportChunks.push(id);
|
1653
|
+
}
|
1682
1654
|
function emitModelChunk(request, id, json) {
|
1683
1655
|
id = id.toString(16) + ":" + json + "\n";
|
1684
1656
|
id = stringToChunk(id);
|
@@ -1832,12 +1804,11 @@
|
|
1832
1804
|
if ("symbol" === typeof value) {
|
1833
1805
|
counter = request.writtenSymbols.get(value);
|
1834
1806
|
if (void 0 !== counter) return serializeByValueID(counter);
|
1835
|
-
|
1807
|
+
value = value.description;
|
1836
1808
|
request.pendingChunks++;
|
1837
|
-
|
1838
|
-
|
1839
|
-
|
1840
|
-
return serializeByValueID(value);
|
1809
|
+
counter = request.nextChunkId++;
|
1810
|
+
emitSymbolChunk(request, counter, value);
|
1811
|
+
return serializeByValueID(counter);
|
1841
1812
|
}
|
1842
1813
|
return "bigint" === typeof value
|
1843
1814
|
? "$n" + value.toString(10)
|
@@ -1969,7 +1940,7 @@
|
|
1969
1940
|
} else {
|
1970
1941
|
request.abortableTasks.delete(task);
|
1971
1942
|
task.status = 4;
|
1972
|
-
var digest = logRecoverableError(request, x);
|
1943
|
+
var digest = logRecoverableError(request, x, task);
|
1973
1944
|
emitErrorChunk(request, task.id, digest, x);
|
1974
1945
|
}
|
1975
1946
|
} finally {
|
@@ -1999,7 +1970,8 @@
|
|
1999
1970
|
null !== request.destination &&
|
2000
1971
|
flushCompletedChunks(request, request.destination);
|
2001
1972
|
} catch (error$2) {
|
2002
|
-
logRecoverableError(request, error$2
|
1973
|
+
logRecoverableError(request, error$2, null),
|
1974
|
+
fatalError(request, error$2);
|
2003
1975
|
} finally {
|
2004
1976
|
(ReactSharedInternalsServer.H = prevDispatcher),
|
2005
1977
|
(currentRequest$1 = null),
|
@@ -2104,7 +2076,7 @@
|
|
2104
2076
|
"function" === typeof reason.then
|
2105
2077
|
? Error("The render was aborted by the server with a promise.")
|
2106
2078
|
: reason,
|
2107
|
-
digest = logRecoverableError(request, error);
|
2079
|
+
digest = logRecoverableError(request, error, null);
|
2108
2080
|
emitErrorChunk(request, errorId, digest, error);
|
2109
2081
|
abortableTasks.forEach(function (task) {
|
2110
2082
|
if (5 !== task.status) {
|
@@ -2134,7 +2106,8 @@
|
|
2134
2106
|
null !== request.destination &&
|
2135
2107
|
flushCompletedChunks(request, request.destination);
|
2136
2108
|
} catch (error$4) {
|
2137
|
-
logRecoverableError(request, error$4
|
2109
|
+
logRecoverableError(request, error$4, null),
|
2110
|
+
fatalError(request, error$4);
|
2138
2111
|
}
|
2139
2112
|
}
|
2140
2113
|
function resolveServerReference(bundlerConfig, id) {
|
@@ -3235,8 +3208,9 @@
|
|
3235
3208
|
getOwner: function () {
|
3236
3209
|
return currentOwner ? currentOwner : null;
|
3237
3210
|
}
|
3238
|
-
}
|
3239
|
-
|
3211
|
+
};
|
3212
|
+
new ("function" === typeof WeakMap ? WeakMap : Map)();
|
3213
|
+
var isArrayImpl = Array.isArray,
|
3240
3214
|
getPrototypeOf = Object.getPrototypeOf,
|
3241
3215
|
jsxPropsParents = new WeakMap(),
|
3242
3216
|
jsxChildrenParents = new WeakMap(),
|
@@ -3410,7 +3384,7 @@
|
|
3410
3384
|
try {
|
3411
3385
|
flushCompletedChunks(request, controller);
|
3412
3386
|
} catch (error$3) {
|
3413
|
-
logRecoverableError(request, error$3),
|
3387
|
+
logRecoverableError(request, error$3, null),
|
3414
3388
|
fatalError(request, error$3);
|
3415
3389
|
}
|
3416
3390
|
}
|