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
@@ -299,6 +299,24 @@
|
|
299
299
|
if (!(object[i] in ObjectPrototype)) return !1;
|
300
300
|
return !0;
|
301
301
|
}
|
302
|
+
function isSimpleObject(object) {
|
303
|
+
if (!isObjectPrototype(getPrototypeOf(object))) return !1;
|
304
|
+
for (
|
305
|
+
var names = Object.getOwnPropertyNames(object), i = 0;
|
306
|
+
i < names.length;
|
307
|
+
i++
|
308
|
+
) {
|
309
|
+
var descriptor = Object.getOwnPropertyDescriptor(object, names[i]);
|
310
|
+
if (
|
311
|
+
!descriptor ||
|
312
|
+
(!descriptor.enumerable &&
|
313
|
+
(("key" !== names[i] && "ref" !== names[i]) ||
|
314
|
+
"function" !== typeof descriptor.get))
|
315
|
+
)
|
316
|
+
return !1;
|
317
|
+
}
|
318
|
+
return !0;
|
319
|
+
}
|
302
320
|
function objectName(object) {
|
303
321
|
return Object.prototype.toString
|
304
322
|
.call(object)
|
@@ -467,6 +485,9 @@
|
|
467
485
|
error += "\n at " + structuredStackTrace[i].toString();
|
468
486
|
return error;
|
469
487
|
}
|
488
|
+
function getCurrentStackInDEV() {
|
489
|
+
return "";
|
490
|
+
}
|
470
491
|
function defaultErrorHandler(error) {
|
471
492
|
console.error(error);
|
472
493
|
}
|
@@ -488,6 +509,7 @@
|
|
488
509
|
"Currently React only supports one RSC renderer at a time."
|
489
510
|
);
|
490
511
|
ReactSharedInternalsServer.A = DefaultAsyncDispatcher;
|
512
|
+
ReactSharedInternalsServer.getCurrentStack = getCurrentStackInDEV;
|
491
513
|
var abortSet = new Set(),
|
492
514
|
pingedTasks = [],
|
493
515
|
hints = new Set();
|
@@ -557,7 +579,7 @@
|
|
557
579
|
);
|
558
580
|
case "rejected":
|
559
581
|
task = thenable.reason;
|
560
|
-
var digest = logRecoverableError(request, task);
|
582
|
+
var digest = logRecoverableError(request, task, null);
|
561
583
|
emitErrorChunk(request, newTask.id, digest, task);
|
562
584
|
return newTask.id;
|
563
585
|
default:
|
@@ -590,7 +612,7 @@
|
|
590
612
|
},
|
591
613
|
function (reason) {
|
592
614
|
newTask.status = 4;
|
593
|
-
var _digest = logRecoverableError(request, reason);
|
615
|
+
var _digest = logRecoverableError(request, reason, newTask);
|
594
616
|
emitErrorChunk(request, newTask.id, _digest, reason);
|
595
617
|
request.abortableTasks.delete(newTask);
|
596
618
|
enqueueFlush(request);
|
@@ -622,7 +644,7 @@
|
|
622
644
|
if (!aborted) {
|
623
645
|
aborted = !0;
|
624
646
|
request.abortListeners.delete(error);
|
625
|
-
var digest = logRecoverableError(request, reason);
|
647
|
+
var digest = logRecoverableError(request, reason, streamTask);
|
626
648
|
emitErrorChunk(request, streamTask.id, digest, reason);
|
627
649
|
enqueueFlush(request);
|
628
650
|
reader.cancel(reason).then(error, error);
|
@@ -693,7 +715,7 @@
|
|
693
715
|
if (!aborted) {
|
694
716
|
aborted = !0;
|
695
717
|
request.abortListeners.delete(error);
|
696
|
-
var digest = logRecoverableError(request, reason);
|
718
|
+
var digest = logRecoverableError(request, reason, streamTask);
|
697
719
|
emitErrorChunk(request, streamTask.id, digest, reason);
|
698
720
|
enqueueFlush(request);
|
699
721
|
"function" === typeof iterator.throw &&
|
@@ -775,32 +797,41 @@
|
|
775
797
|
var init = lazy._init;
|
776
798
|
return init(lazy._payload);
|
777
799
|
}
|
778
|
-
function
|
779
|
-
|
780
|
-
|
781
|
-
|
782
|
-
|
783
|
-
|
784
|
-
|
785
|
-
|
786
|
-
|
787
|
-
|
788
|
-
stack = task.thenableState;
|
800
|
+
function callWithDebugContextInDEV(task, callback, arg) {
|
801
|
+
currentOwner = { env: task.environmentName, owner: task.debugOwner };
|
802
|
+
try {
|
803
|
+
return callback(arg);
|
804
|
+
} finally {
|
805
|
+
currentOwner = null;
|
806
|
+
}
|
807
|
+
}
|
808
|
+
function renderFunctionComponent(request, task, key, Component, props) {
|
809
|
+
var prevThenableState = task.thenableState;
|
789
810
|
task.thenableState = null;
|
790
811
|
if (null === debugID) return outlineTask(request, task);
|
791
|
-
if (null !==
|
812
|
+
if (null !== prevThenableState)
|
813
|
+
var componentDebugInfo = prevThenableState._componentDebugInfo;
|
792
814
|
else {
|
793
|
-
var componentDebugID = debugID
|
794
|
-
|
795
|
-
|
815
|
+
var componentDebugID = debugID;
|
816
|
+
componentDebugInfo = Component.displayName || Component.name || "";
|
817
|
+
var componentEnv = request.environmentName();
|
796
818
|
request.pendingChunks++;
|
797
|
-
|
798
|
-
|
799
|
-
|
819
|
+
componentDebugInfo = {
|
820
|
+
name: componentDebugInfo,
|
821
|
+
env: componentEnv,
|
822
|
+
owner: task.debugOwner
|
823
|
+
};
|
824
|
+
outlineModel(request, componentDebugInfo);
|
825
|
+
emitDebugChunk(request, componentDebugID, componentDebugInfo);
|
800
826
|
task.environmentName = componentEnv;
|
801
827
|
}
|
802
|
-
prepareToUseHooksForComponent(
|
803
|
-
props = callComponentInDEV(
|
828
|
+
prepareToUseHooksForComponent(prevThenableState, componentDebugInfo);
|
829
|
+
props = callComponentInDEV(
|
830
|
+
Component,
|
831
|
+
props,
|
832
|
+
componentDebugInfo,
|
833
|
+
task.debugTask
|
834
|
+
);
|
804
835
|
if (1 === request.status) throw AbortSigil;
|
805
836
|
if (
|
806
837
|
"object" === typeof props &&
|
@@ -808,8 +839,8 @@
|
|
808
839
|
props.$$typeof !== CLIENT_REFERENCE_TAG$1
|
809
840
|
) {
|
810
841
|
if ("function" === typeof props.then) {
|
811
|
-
|
812
|
-
|
842
|
+
prevThenableState = props;
|
843
|
+
prevThenableState.then(
|
813
844
|
function (resolvedValue) {
|
814
845
|
"object" === typeof resolvedValue &&
|
815
846
|
null !== resolvedValue &&
|
@@ -818,7 +849,8 @@
|
|
818
849
|
},
|
819
850
|
function () {}
|
820
851
|
);
|
821
|
-
if ("fulfilled" ===
|
852
|
+
if ("fulfilled" === prevThenableState.status)
|
853
|
+
return prevThenableState.value;
|
822
854
|
props = createLazyWrapperAroundWakeable(props);
|
823
855
|
}
|
824
856
|
var iteratorFn = getIteratorFn(props);
|
@@ -831,9 +863,11 @@
|
|
831
863
|
Object.prototype.toString.call(Component) &&
|
832
864
|
"[object Generator]" ===
|
833
865
|
Object.prototype.toString.call(iterableChild)) ||
|
834
|
-
|
835
|
-
|
836
|
-
|
866
|
+
callWithDebugContextInDEV(task, function () {
|
867
|
+
error$jscomp$0(
|
868
|
+
"Returning an Iterator from a Server Component is not supported since it cannot be looped over more than once. "
|
869
|
+
);
|
870
|
+
});
|
837
871
|
return iterator;
|
838
872
|
});
|
839
873
|
props._debugInfo = iterableChild._debugInfo;
|
@@ -852,22 +886,25 @@
|
|
852
886
|
Object.prototype.toString.call(Component) &&
|
853
887
|
"[object AsyncGenerator]" ===
|
854
888
|
Object.prototype.toString.call(_iterableChild)) ||
|
855
|
-
|
856
|
-
|
857
|
-
|
889
|
+
callWithDebugContextInDEV(task, function () {
|
890
|
+
error$jscomp$0(
|
891
|
+
"Returning an AsyncIterator from a Server Component is not supported since it cannot be looped over more than once. "
|
892
|
+
);
|
893
|
+
});
|
858
894
|
return iterator;
|
859
895
|
});
|
860
896
|
props._debugInfo = _iterableChild._debugInfo;
|
861
897
|
}
|
862
898
|
}
|
863
|
-
|
864
|
-
|
899
|
+
prevThenableState = task.keyPath;
|
900
|
+
componentDebugID = task.implicitSlot;
|
865
901
|
null !== key
|
866
|
-
? (task.keyPath =
|
867
|
-
|
902
|
+
? (task.keyPath =
|
903
|
+
null === prevThenableState ? key : prevThenableState + "," + key)
|
904
|
+
: null === prevThenableState && (task.implicitSlot = !0);
|
868
905
|
request = renderModelDestructive(request, task, emptyRoot, "", props);
|
869
|
-
task.keyPath =
|
870
|
-
task.implicitSlot =
|
906
|
+
task.keyPath = prevThenableState;
|
907
|
+
task.implicitSlot = componentDebugID;
|
871
908
|
return request;
|
872
909
|
}
|
873
910
|
function renderFragment(request, task, children) {
|
@@ -898,6 +935,21 @@
|
|
898
935
|
}
|
899
936
|
return children;
|
900
937
|
}
|
938
|
+
function renderAsyncFragment(request, task, children, getAsyncIterator) {
|
939
|
+
if (null !== task.keyPath)
|
940
|
+
return (
|
941
|
+
(request = [
|
942
|
+
REACT_ELEMENT_TYPE,
|
943
|
+
REACT_FRAGMENT_TYPE,
|
944
|
+
task.keyPath,
|
945
|
+
{ children: children },
|
946
|
+
null
|
947
|
+
]),
|
948
|
+
task.implicitSlot ? [request] : request
|
949
|
+
);
|
950
|
+
getAsyncIterator = getAsyncIterator.call(children);
|
951
|
+
return serializeAsyncIterable(request, task, children, getAsyncIterator);
|
952
|
+
}
|
901
953
|
function outlineTask(request, task) {
|
902
954
|
task = createTask(
|
903
955
|
request,
|
@@ -911,17 +963,7 @@
|
|
911
963
|
? serializeByValueID(task.id)
|
912
964
|
: serializeLazyID(task.id);
|
913
965
|
}
|
914
|
-
function renderElement(
|
915
|
-
request,
|
916
|
-
task,
|
917
|
-
type,
|
918
|
-
key,
|
919
|
-
ref,
|
920
|
-
props,
|
921
|
-
owner,
|
922
|
-
stack,
|
923
|
-
debugTask
|
924
|
-
) {
|
966
|
+
function renderElement(request, task, type, key, ref, props) {
|
925
967
|
if (null !== ref && void 0 !== ref)
|
926
968
|
throw Error(
|
927
969
|
"Refs cannot be used in Server Components, nor passed to Client Components."
|
@@ -935,19 +977,10 @@
|
|
935
977
|
type.$$typeof !== CLIENT_REFERENCE_TAG$1 &&
|
936
978
|
type.$$typeof !== TEMPORARY_REFERENCE_TAG
|
937
979
|
)
|
938
|
-
return renderFunctionComponent(
|
939
|
-
request,
|
940
|
-
task,
|
941
|
-
key,
|
942
|
-
type,
|
943
|
-
props,
|
944
|
-
owner,
|
945
|
-
stack,
|
946
|
-
debugTask
|
947
|
-
);
|
980
|
+
return renderFunctionComponent(request, task, key, type, props);
|
948
981
|
if (type === REACT_FRAGMENT_TYPE && null === key)
|
949
982
|
return (
|
950
|
-
(
|
983
|
+
(type = task.implicitSlot),
|
951
984
|
null === task.keyPath && (task.implicitSlot = !0),
|
952
985
|
(props = renderModelDestructive(
|
953
986
|
request,
|
@@ -956,7 +989,7 @@
|
|
956
989
|
"",
|
957
990
|
props.children
|
958
991
|
)),
|
959
|
-
(task.implicitSlot =
|
992
|
+
(task.implicitSlot = type),
|
960
993
|
props
|
961
994
|
);
|
962
995
|
if (
|
@@ -968,40 +1001,17 @@
|
|
968
1001
|
case REACT_LAZY_TYPE:
|
969
1002
|
type = callLazyInitInDEV(type);
|
970
1003
|
if (1 === request.status) throw AbortSigil;
|
971
|
-
return renderElement(
|
972
|
-
request,
|
973
|
-
task,
|
974
|
-
type,
|
975
|
-
key,
|
976
|
-
ref,
|
977
|
-
props,
|
978
|
-
owner,
|
979
|
-
stack,
|
980
|
-
debugTask
|
981
|
-
);
|
1004
|
+
return renderElement(request, task, type, key, ref, props);
|
982
1005
|
case REACT_FORWARD_REF_TYPE:
|
983
1006
|
return renderFunctionComponent(
|
984
1007
|
request,
|
985
1008
|
task,
|
986
1009
|
key,
|
987
1010
|
type.render,
|
988
|
-
props
|
989
|
-
owner,
|
990
|
-
stack,
|
991
|
-
debugTask
|
1011
|
+
props
|
992
1012
|
);
|
993
1013
|
case REACT_MEMO_TYPE:
|
994
|
-
return renderElement(
|
995
|
-
request,
|
996
|
-
task,
|
997
|
-
type.type,
|
998
|
-
key,
|
999
|
-
ref,
|
1000
|
-
props,
|
1001
|
-
owner,
|
1002
|
-
stack,
|
1003
|
-
debugTask
|
1004
|
-
);
|
1014
|
+
return renderElement(request, task, type.type, key, ref, props);
|
1005
1015
|
case REACT_ELEMENT_TYPE:
|
1006
1016
|
type._store.validated = 1;
|
1007
1017
|
}
|
@@ -1010,7 +1020,7 @@
|
|
1010
1020
|
null === request
|
1011
1021
|
? (request = key)
|
1012
1022
|
: null !== key && (request = key + "," + request);
|
1013
|
-
props = [REACT_ELEMENT_TYPE, type, request, props,
|
1023
|
+
props = [REACT_ELEMENT_TYPE, type, request, props, task.debugOwner];
|
1014
1024
|
task = task.implicitSlot && null !== request ? [props] : props;
|
1015
1025
|
return task;
|
1016
1026
|
}
|
@@ -1041,95 +1051,30 @@
|
|
1041
1051
|
return pingTask(request, task);
|
1042
1052
|
},
|
1043
1053
|
toJSON: function (parentPropertyName, value) {
|
1044
|
-
var
|
1054
|
+
var parent = this,
|
1055
|
+
originalValue = parent[parentPropertyName];
|
1045
1056
|
"object" !== typeof originalValue ||
|
1046
1057
|
originalValue === value ||
|
1047
1058
|
originalValue instanceof Date ||
|
1048
|
-
(
|
1049
|
-
|
1050
|
-
?
|
1051
|
-
|
1052
|
-
|
1053
|
-
|
1054
|
-
|
1059
|
+
callWithDebugContextInDEV(task, function () {
|
1060
|
+
"Object" !== objectName(originalValue)
|
1061
|
+
? "string" === typeof jsxChildrenParents.get(parent)
|
1062
|
+
? error$jscomp$0(
|
1063
|
+
"%s objects cannot be rendered as text children. Try formatting it using toString().%s",
|
1064
|
+
objectName(originalValue),
|
1065
|
+
describeObjectForErrorMessage(parent, parentPropertyName)
|
1066
|
+
)
|
1067
|
+
: error$jscomp$0(
|
1068
|
+
"Only plain objects can be passed to Client Components from Server Components. %s objects are not supported.%s",
|
1069
|
+
objectName(originalValue),
|
1070
|
+
describeObjectForErrorMessage(parent, parentPropertyName)
|
1071
|
+
)
|
1055
1072
|
: error$jscomp$0(
|
1056
|
-
"Only plain objects can be passed to Client Components from Server Components.
|
1057
|
-
|
1058
|
-
|
1059
|
-
|
1060
|
-
|
1061
|
-
"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",
|
1062
|
-
describeObjectForErrorMessage(this, parentPropertyName)
|
1063
|
-
));
|
1064
|
-
originalValue = task;
|
1065
|
-
var prevKeyPath = originalValue.keyPath,
|
1066
|
-
prevImplicitSlot = originalValue.implicitSlot;
|
1067
|
-
try {
|
1068
|
-
var JSCompiler_inline_result = renderModelDestructive(
|
1069
|
-
request,
|
1070
|
-
originalValue,
|
1071
|
-
this,
|
1072
|
-
parentPropertyName,
|
1073
|
-
value
|
1074
|
-
);
|
1075
|
-
} catch (thrownValue) {
|
1076
|
-
if (
|
1077
|
-
((parentPropertyName = originalValue.model),
|
1078
|
-
(parentPropertyName =
|
1079
|
-
"object" === typeof parentPropertyName &&
|
1080
|
-
null !== parentPropertyName &&
|
1081
|
-
(parentPropertyName.$$typeof === REACT_ELEMENT_TYPE ||
|
1082
|
-
parentPropertyName.$$typeof === REACT_LAZY_TYPE)),
|
1083
|
-
(value =
|
1084
|
-
thrownValue === SuspenseException
|
1085
|
-
? getSuspendedThenable()
|
1086
|
-
: thrownValue),
|
1087
|
-
"object" === typeof value &&
|
1088
|
-
null !== value &&
|
1089
|
-
"function" === typeof value.then)
|
1090
|
-
)
|
1091
|
-
if (1 === request.status)
|
1092
|
-
(originalValue.status = 3),
|
1093
|
-
(originalValue = request.fatalError),
|
1094
|
-
(JSCompiler_inline_result = parentPropertyName
|
1095
|
-
? serializeLazyID(originalValue)
|
1096
|
-
: serializeByValueID(originalValue));
|
1097
|
-
else {
|
1098
|
-
JSCompiler_inline_result = createTask(
|
1099
|
-
request,
|
1100
|
-
originalValue.model,
|
1101
|
-
originalValue.keyPath,
|
1102
|
-
originalValue.implicitSlot,
|
1103
|
-
request.abortableTasks
|
1104
|
-
);
|
1105
|
-
var ping = JSCompiler_inline_result.ping;
|
1106
|
-
value.then(ping, ping);
|
1107
|
-
JSCompiler_inline_result.thenableState =
|
1108
|
-
getThenableStateAfterSuspending();
|
1109
|
-
originalValue.keyPath = prevKeyPath;
|
1110
|
-
originalValue.implicitSlot = prevImplicitSlot;
|
1111
|
-
JSCompiler_inline_result = parentPropertyName
|
1112
|
-
? serializeLazyID(JSCompiler_inline_result.id)
|
1113
|
-
: serializeByValueID(JSCompiler_inline_result.id);
|
1114
|
-
}
|
1115
|
-
else
|
1116
|
-
thrownValue === AbortSigil
|
1117
|
-
? ((originalValue.status = 3),
|
1118
|
-
(originalValue = request.fatalError),
|
1119
|
-
(JSCompiler_inline_result = parentPropertyName
|
1120
|
-
? serializeLazyID(originalValue)
|
1121
|
-
: serializeByValueID(originalValue)))
|
1122
|
-
: ((originalValue.keyPath = prevKeyPath),
|
1123
|
-
(originalValue.implicitSlot = prevImplicitSlot),
|
1124
|
-
request.pendingChunks++,
|
1125
|
-
(originalValue = request.nextChunkId++),
|
1126
|
-
(prevKeyPath = logRecoverableError(request, value)),
|
1127
|
-
emitErrorChunk(request, originalValue, prevKeyPath, value),
|
1128
|
-
(JSCompiler_inline_result = parentPropertyName
|
1129
|
-
? serializeLazyID(originalValue)
|
1130
|
-
: serializeByValueID(originalValue)));
|
1131
|
-
}
|
1132
|
-
return JSCompiler_inline_result;
|
1073
|
+
"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",
|
1074
|
+
describeObjectForErrorMessage(parent, parentPropertyName)
|
1075
|
+
);
|
1076
|
+
});
|
1077
|
+
return renderModel(request, task, parent, parentPropertyName, value);
|
1133
1078
|
},
|
1134
1079
|
thenableState: null
|
1135
1080
|
};
|
@@ -1210,7 +1155,7 @@
|
|
1210
1155
|
return (
|
1211
1156
|
request.pendingChunks++,
|
1212
1157
|
(parent = request.nextChunkId++),
|
1213
|
-
(parentPropertyName = logRecoverableError(request, x)),
|
1158
|
+
(parentPropertyName = logRecoverableError(request, x, null)),
|
1214
1159
|
emitErrorChunk(request, parent, parentPropertyName, x),
|
1215
1160
|
serializeByValueID(parent)
|
1216
1161
|
);
|
@@ -1221,6 +1166,19 @@
|
|
1221
1166
|
retryTask(request, value);
|
1222
1167
|
return value.id;
|
1223
1168
|
}
|
1169
|
+
function serializeServerReference(request, serverReference) {
|
1170
|
+
var writtenServerReferences = request.writtenServerReferences,
|
1171
|
+
existingId = writtenServerReferences.get(serverReference);
|
1172
|
+
if (void 0 !== existingId) return "$F" + existingId.toString(16);
|
1173
|
+
existingId = serverReference.$$bound;
|
1174
|
+
existingId = {
|
1175
|
+
id: serverReference.$$id,
|
1176
|
+
bound: existingId ? Promise.resolve(existingId) : null
|
1177
|
+
};
|
1178
|
+
request = outlineModel(request, existingId);
|
1179
|
+
writtenServerReferences.set(serverReference, request);
|
1180
|
+
return "$F" + request.toString(16);
|
1181
|
+
}
|
1224
1182
|
function serializeLargeTextString(request, text) {
|
1225
1183
|
request.pendingChunks++;
|
1226
1184
|
var textId = request.nextChunkId++;
|
@@ -1261,7 +1219,7 @@
|
|
1261
1219
|
if (!aborted) {
|
1262
1220
|
aborted = !0;
|
1263
1221
|
request.abortListeners.delete(error);
|
1264
|
-
var digest = logRecoverableError(request, reason);
|
1222
|
+
var digest = logRecoverableError(request, reason, newTask);
|
1265
1223
|
emitErrorChunk(request, newTask.id, digest, reason);
|
1266
1224
|
request.abortableTasks.delete(newTask);
|
1267
1225
|
enqueueFlush(request);
|
@@ -1276,6 +1234,66 @@
|
|
1276
1234
|
reader.read().then(progress).catch(error);
|
1277
1235
|
return "$B" + newTask.id.toString(16);
|
1278
1236
|
}
|
1237
|
+
function renderModel(request, task, parent, key, value) {
|
1238
|
+
var prevKeyPath = task.keyPath,
|
1239
|
+
prevImplicitSlot = task.implicitSlot;
|
1240
|
+
try {
|
1241
|
+
return renderModelDestructive(request, task, parent, key, value);
|
1242
|
+
} catch (thrownValue) {
|
1243
|
+
parent = task.model;
|
1244
|
+
parent =
|
1245
|
+
"object" === typeof parent &&
|
1246
|
+
null !== parent &&
|
1247
|
+
(parent.$$typeof === REACT_ELEMENT_TYPE ||
|
1248
|
+
parent.$$typeof === REACT_LAZY_TYPE);
|
1249
|
+
key =
|
1250
|
+
thrownValue === SuspenseException
|
1251
|
+
? getSuspendedThenable()
|
1252
|
+
: thrownValue;
|
1253
|
+
if (
|
1254
|
+
"object" === typeof key &&
|
1255
|
+
null !== key &&
|
1256
|
+
"function" === typeof key.then
|
1257
|
+
) {
|
1258
|
+
if (1 === request.status)
|
1259
|
+
return (
|
1260
|
+
(task.status = 3),
|
1261
|
+
(task = request.fatalError),
|
1262
|
+
parent ? serializeLazyID(task) : serializeByValueID(task)
|
1263
|
+
);
|
1264
|
+
request = createTask(
|
1265
|
+
request,
|
1266
|
+
task.model,
|
1267
|
+
task.keyPath,
|
1268
|
+
task.implicitSlot,
|
1269
|
+
request.abortableTasks
|
1270
|
+
);
|
1271
|
+
value = request.ping;
|
1272
|
+
key.then(value, value);
|
1273
|
+
request.thenableState = getThenableStateAfterSuspending();
|
1274
|
+
task.keyPath = prevKeyPath;
|
1275
|
+
task.implicitSlot = prevImplicitSlot;
|
1276
|
+
return parent
|
1277
|
+
? serializeLazyID(request.id)
|
1278
|
+
: serializeByValueID(request.id);
|
1279
|
+
}
|
1280
|
+
if (thrownValue === AbortSigil)
|
1281
|
+
return (
|
1282
|
+
(task.status = 3),
|
1283
|
+
(task = request.fatalError),
|
1284
|
+
parent ? serializeLazyID(task) : serializeByValueID(task)
|
1285
|
+
);
|
1286
|
+
task.keyPath = prevKeyPath;
|
1287
|
+
task.implicitSlot = prevImplicitSlot;
|
1288
|
+
request.pendingChunks++;
|
1289
|
+
prevKeyPath = request.nextChunkId++;
|
1290
|
+
task = logRecoverableError(request, key, task);
|
1291
|
+
emitErrorChunk(request, prevKeyPath, task, key);
|
1292
|
+
return parent
|
1293
|
+
? serializeLazyID(prevKeyPath)
|
1294
|
+
: serializeByValueID(prevKeyPath);
|
1295
|
+
}
|
1296
|
+
}
|
1279
1297
|
function renderModelDestructive(
|
1280
1298
|
request,
|
1281
1299
|
task,
|
@@ -1298,48 +1316,47 @@
|
|
1298
1316
|
else return _existingReference;
|
1299
1317
|
else
|
1300
1318
|
-1 === parentPropertyName.indexOf(":") &&
|
1301
|
-
((
|
1302
|
-
void 0 !==
|
1303
|
-
((elementReference =
|
1319
|
+
((_existingReference = _writtenObjects.get(parent)),
|
1320
|
+
void 0 !== _existingReference &&
|
1321
|
+
((elementReference =
|
1322
|
+
_existingReference + ":" + parentPropertyName),
|
1304
1323
|
_writtenObjects.set(value, elementReference)));
|
1305
1324
|
}
|
1306
|
-
if ((
|
1325
|
+
if ((_existingReference = value._debugInfo)) {
|
1307
1326
|
if (null === debugID) return outlineTask(request, task);
|
1308
|
-
forwardDebugInfo(request, debugID,
|
1327
|
+
forwardDebugInfo(request, debugID, _existingReference);
|
1309
1328
|
}
|
1310
|
-
|
1311
|
-
|
1312
|
-
|
1329
|
+
_existingReference = value.props;
|
1330
|
+
var refProp = _existingReference.ref;
|
1331
|
+
task.debugOwner = value._owner;
|
1332
|
+
request = renderElement(
|
1313
1333
|
request,
|
1314
1334
|
task,
|
1315
1335
|
value.type,
|
1316
1336
|
value.key,
|
1317
|
-
void 0 !==
|
1318
|
-
|
1319
|
-
value._owner,
|
1320
|
-
null,
|
1321
|
-
null
|
1337
|
+
void 0 !== refProp ? refProp : null,
|
1338
|
+
_existingReference
|
1322
1339
|
);
|
1323
|
-
"object" === typeof
|
1324
|
-
null !==
|
1340
|
+
"object" === typeof request &&
|
1341
|
+
null !== request &&
|
1325
1342
|
null !== elementReference &&
|
1326
|
-
(_writtenObjects.has(
|
1327
|
-
_writtenObjects.set(
|
1328
|
-
return
|
1343
|
+
(_writtenObjects.has(request) ||
|
1344
|
+
_writtenObjects.set(request, elementReference));
|
1345
|
+
return request;
|
1329
1346
|
case REACT_LAZY_TYPE:
|
1330
1347
|
task.thenableState = null;
|
1331
|
-
|
1348
|
+
elementReference = callLazyInitInDEV(value);
|
1332
1349
|
if (1 === request.status) throw AbortSigil;
|
1333
|
-
if ((
|
1350
|
+
if ((_writtenObjects = value._debugInfo)) {
|
1334
1351
|
if (null === debugID) return outlineTask(request, task);
|
1335
|
-
forwardDebugInfo(request, debugID,
|
1352
|
+
forwardDebugInfo(request, debugID, _writtenObjects);
|
1336
1353
|
}
|
1337
1354
|
return renderModelDestructive(
|
1338
1355
|
request,
|
1339
1356
|
task,
|
1340
1357
|
emptyRoot,
|
1341
1358
|
"",
|
1342
|
-
|
1359
|
+
elementReference
|
1343
1360
|
);
|
1344
1361
|
case REACT_LEGACY_ELEMENT_TYPE:
|
1345
1362
|
throw Error(
|
@@ -1434,13 +1451,11 @@
|
|
1434
1451
|
return serializeBlob(request, value);
|
1435
1452
|
if ((elementReference = getIteratorFn(value)))
|
1436
1453
|
return (
|
1437
|
-
(
|
1438
|
-
|
1454
|
+
(elementReference = elementReference.call(value)),
|
1455
|
+
elementReference === value
|
1439
1456
|
? "$i" +
|
1440
|
-
outlineModel(request, Array.from(
|
1441
|
-
|
1442
|
-
)
|
1443
|
-
: renderFragment(request, task, Array.from(parentPropertyName))
|
1457
|
+
outlineModel(request, Array.from(elementReference)).toString(16)
|
1458
|
+
: renderFragment(request, task, Array.from(elementReference))
|
1444
1459
|
);
|
1445
1460
|
if (
|
1446
1461
|
"function" === typeof ReadableStream &&
|
@@ -1449,25 +1464,7 @@
|
|
1449
1464
|
return serializeReadableStream(request, task, value);
|
1450
1465
|
elementReference = value[ASYNC_ITERATOR];
|
1451
1466
|
if ("function" === typeof elementReference)
|
1452
|
-
return (
|
1453
|
-
null !== task.keyPath
|
1454
|
-
? ((value = [
|
1455
|
-
REACT_ELEMENT_TYPE,
|
1456
|
-
REACT_FRAGMENT_TYPE,
|
1457
|
-
task.keyPath,
|
1458
|
-
{ children: value },
|
1459
|
-
null
|
1460
|
-
]),
|
1461
|
-
(value = task.implicitSlot ? [value] : value))
|
1462
|
-
: ((parentPropertyName = elementReference.call(value)),
|
1463
|
-
(value = serializeAsyncIterable(
|
1464
|
-
request,
|
1465
|
-
task,
|
1466
|
-
value,
|
1467
|
-
parentPropertyName
|
1468
|
-
))),
|
1469
|
-
value
|
1470
|
-
);
|
1467
|
+
return renderAsyncFragment(request, task, value, elementReference);
|
1471
1468
|
request = getPrototypeOf(value);
|
1472
1469
|
if (
|
1473
1470
|
request !== ObjectPrototype &&
|
@@ -1487,43 +1484,30 @@
|
|
1487
1484
|
)
|
1488
1485
|
return { name: value.name, env: value.env, owner: value.owner };
|
1489
1486
|
if ("Object" !== objectName(value))
|
1490
|
-
|
1491
|
-
|
1492
|
-
|
1493
|
-
|
1494
|
-
|
1495
|
-
|
1496
|
-
|
1497
|
-
|
1498
|
-
|
1499
|
-
|
1500
|
-
|
1501
|
-
|
1502
|
-
|
1503
|
-
|
1504
|
-
|
1505
|
-
|
1506
|
-
|
1507
|
-
|
1508
|
-
|
1509
|
-
|
1510
|
-
|
1511
|
-
}
|
1512
|
-
request = !0;
|
1513
|
-
} else request = !1;
|
1514
|
-
request
|
1515
|
-
? Object.getOwnPropertySymbols &&
|
1516
|
-
((request = Object.getOwnPropertySymbols(value)),
|
1517
|
-
0 < request.length &&
|
1518
|
-
error$jscomp$0(
|
1519
|
-
"Only plain objects can be passed to Client Components from Server Components. Objects with symbol properties like %s are not supported.%s",
|
1520
|
-
request[0].description,
|
1521
|
-
describeObjectForErrorMessage(parent, parentPropertyName)
|
1522
|
-
))
|
1523
|
-
: error$jscomp$0(
|
1524
|
-
"Only plain objects can be passed to Client Components from Server Components. Classes or other objects with methods are not supported.%s",
|
1487
|
+
callWithDebugContextInDEV(task, function () {
|
1488
|
+
error$jscomp$0(
|
1489
|
+
"Only plain objects can be passed to Client Components from Server Components. %s objects are not supported.%s",
|
1490
|
+
objectName(value),
|
1491
|
+
describeObjectForErrorMessage(parent, parentPropertyName)
|
1492
|
+
);
|
1493
|
+
});
|
1494
|
+
else if (!isSimpleObject(value))
|
1495
|
+
callWithDebugContextInDEV(task, function () {
|
1496
|
+
error$jscomp$0(
|
1497
|
+
"Only plain objects can be passed to Client Components from Server Components. Classes or other objects with methods are not supported.%s",
|
1498
|
+
describeObjectForErrorMessage(parent, parentPropertyName)
|
1499
|
+
);
|
1500
|
+
});
|
1501
|
+
else if (Object.getOwnPropertySymbols) {
|
1502
|
+
var symbols = Object.getOwnPropertySymbols(value);
|
1503
|
+
0 < symbols.length &&
|
1504
|
+
callWithDebugContextInDEV(task, function () {
|
1505
|
+
error$jscomp$0(
|
1506
|
+
"Only plain objects can be passed to Client Components from Server Components. Objects with symbol properties like %s are not supported.%s",
|
1507
|
+
symbols[0].description,
|
1525
1508
|
describeObjectForErrorMessage(parent, parentPropertyName)
|
1526
1509
|
);
|
1510
|
+
});
|
1527
1511
|
}
|
1528
1512
|
return value;
|
1529
1513
|
}
|
@@ -1548,21 +1532,7 @@
|
|
1548
1532
|
value
|
1549
1533
|
);
|
1550
1534
|
if (value.$$typeof === SERVER_REFERENCE_TAG)
|
1551
|
-
return (
|
1552
|
-
(parentPropertyName = request.writtenServerReferences),
|
1553
|
-
(parent = parentPropertyName.get(value)),
|
1554
|
-
void 0 !== parent
|
1555
|
-
? (value = "$F" + parent.toString(16))
|
1556
|
-
: ((parent = value.$$bound),
|
1557
|
-
(parent = {
|
1558
|
-
id: value.$$id,
|
1559
|
-
bound: parent ? Promise.resolve(parent) : null
|
1560
|
-
}),
|
1561
|
-
(request = outlineModel(request, parent)),
|
1562
|
-
parentPropertyName.set(value, request),
|
1563
|
-
(value = "$F" + request.toString(16))),
|
1564
|
-
value
|
1565
|
-
);
|
1535
|
+
return serializeServerReference(request, value);
|
1566
1536
|
if (
|
1567
1537
|
void 0 !== request.temporaryReferences &&
|
1568
1538
|
((request = request.temporaryReferences.get(value)),
|
@@ -1584,12 +1554,12 @@
|
|
1584
1554
|
(jsxPropsParents.has(parent) && "children" === parentPropertyName)
|
1585
1555
|
)
|
1586
1556
|
throw (
|
1587
|
-
((
|
1557
|
+
((request = value.displayName || value.name || "Component"),
|
1588
1558
|
Error(
|
1589
1559
|
"Functions are not valid as a child of Client Components. This may happen if you return " +
|
1590
|
-
|
1560
|
+
request +
|
1591
1561
|
" instead of <" +
|
1592
|
-
|
1562
|
+
request +
|
1593
1563
|
" /> from render. Or maybe you meant to call this function rather than return it." +
|
1594
1564
|
describeObjectForErrorMessage(parent, parentPropertyName)
|
1595
1565
|
))
|
@@ -1612,15 +1582,10 @@
|
|
1612
1582
|
describeObjectForErrorMessage(parent, parentPropertyName)
|
1613
1583
|
);
|
1614
1584
|
request.pendingChunks++;
|
1615
|
-
|
1616
|
-
|
1617
|
-
|
1618
|
-
|
1619
|
-
"$S" + elementReference
|
1620
|
-
);
|
1621
|
-
request.completedImportChunks.push(parent);
|
1622
|
-
task.set(value, parentPropertyName);
|
1623
|
-
return serializeByValueID(parentPropertyName);
|
1585
|
+
_writtenObjects = request.nextChunkId++;
|
1586
|
+
emitSymbolChunk(request, _writtenObjects, elementReference);
|
1587
|
+
task.set(value, _writtenObjects);
|
1588
|
+
return serializeByValueID(_writtenObjects);
|
1624
1589
|
}
|
1625
1590
|
if ("bigint" === typeof value) return "$n" + value.toString(10);
|
1626
1591
|
throw Error(
|
@@ -1630,14 +1595,25 @@
|
|
1630
1595
|
describeObjectForErrorMessage(parent, parentPropertyName)
|
1631
1596
|
);
|
1632
1597
|
}
|
1633
|
-
function logRecoverableError(request, error) {
|
1598
|
+
function logRecoverableError(request, error, task) {
|
1634
1599
|
var prevRequest = currentRequest;
|
1635
1600
|
currentRequest = null;
|
1636
1601
|
try {
|
1637
1602
|
var onError = request.onError;
|
1638
|
-
var errorDigest =
|
1639
|
-
|
1640
|
-
|
1603
|
+
var errorDigest =
|
1604
|
+
null !== task
|
1605
|
+
? supportsRequestStorage
|
1606
|
+
? requestStorage.run(
|
1607
|
+
void 0,
|
1608
|
+
callWithDebugContextInDEV,
|
1609
|
+
task,
|
1610
|
+
onError,
|
1611
|
+
error
|
1612
|
+
)
|
1613
|
+
: callWithDebugContextInDEV(task, onError, error)
|
1614
|
+
: supportsRequestStorage
|
1615
|
+
? requestStorage.run(void 0, onError, error)
|
1616
|
+
: onError(error);
|
1641
1617
|
} finally {
|
1642
1618
|
currentRequest = prevRequest;
|
1643
1619
|
}
|
@@ -1687,6 +1663,10 @@
|
|
1687
1663
|
id = stringToChunk(id);
|
1688
1664
|
request.completedErrorChunks.push(id);
|
1689
1665
|
}
|
1666
|
+
function emitSymbolChunk(request, id, name) {
|
1667
|
+
id = encodeReferenceChunk(request, id, "$S" + name);
|
1668
|
+
request.completedImportChunks.push(id);
|
1669
|
+
}
|
1690
1670
|
function emitModelChunk(request, id, json) {
|
1691
1671
|
id = id.toString(16) + ":" + json + "\n";
|
1692
1672
|
id = stringToChunk(id);
|
@@ -1840,12 +1820,11 @@
|
|
1840
1820
|
if ("symbol" === typeof value) {
|
1841
1821
|
counter = request.writtenSymbols.get(value);
|
1842
1822
|
if (void 0 !== counter) return serializeByValueID(counter);
|
1843
|
-
|
1823
|
+
value = value.description;
|
1844
1824
|
request.pendingChunks++;
|
1845
|
-
|
1846
|
-
|
1847
|
-
|
1848
|
-
return serializeByValueID(value);
|
1825
|
+
counter = request.nextChunkId++;
|
1826
|
+
emitSymbolChunk(request, counter, value);
|
1827
|
+
return serializeByValueID(counter);
|
1849
1828
|
}
|
1850
1829
|
return "bigint" === typeof value
|
1851
1830
|
? "$n" + value.toString(10)
|
@@ -1977,7 +1956,7 @@
|
|
1977
1956
|
} else {
|
1978
1957
|
request.abortableTasks.delete(task);
|
1979
1958
|
task.status = 4;
|
1980
|
-
var digest = logRecoverableError(request, x);
|
1959
|
+
var digest = logRecoverableError(request, x, task);
|
1981
1960
|
emitErrorChunk(request, task.id, digest, x);
|
1982
1961
|
}
|
1983
1962
|
} finally {
|
@@ -2007,7 +1986,8 @@
|
|
2007
1986
|
null !== request.destination &&
|
2008
1987
|
flushCompletedChunks(request, request.destination);
|
2009
1988
|
} catch (error$2) {
|
2010
|
-
logRecoverableError(request, error$2
|
1989
|
+
logRecoverableError(request, error$2, null),
|
1990
|
+
fatalError(request, error$2);
|
2011
1991
|
} finally {
|
2012
1992
|
(ReactSharedInternalsServer.H = prevDispatcher),
|
2013
1993
|
(currentRequest$1 = null),
|
@@ -2116,7 +2096,7 @@
|
|
2116
2096
|
"function" === typeof reason.then
|
2117
2097
|
? Error("The render was aborted by the server with a promise.")
|
2118
2098
|
: reason,
|
2119
|
-
digest = logRecoverableError(request, error);
|
2099
|
+
digest = logRecoverableError(request, error, null);
|
2120
2100
|
emitErrorChunk(request, errorId, digest, error);
|
2121
2101
|
abortableTasks.forEach(function (task) {
|
2122
2102
|
if (5 !== task.status) {
|
@@ -2146,7 +2126,8 @@
|
|
2146
2126
|
null !== request.destination &&
|
2147
2127
|
flushCompletedChunks(request, request.destination);
|
2148
2128
|
} catch (error$4) {
|
2149
|
-
logRecoverableError(request, error$4
|
2129
|
+
logRecoverableError(request, error$4, null),
|
2130
|
+
fatalError(request, error$4);
|
2150
2131
|
}
|
2151
2132
|
}
|
2152
2133
|
function resolveServerReference(bundlerConfig, id) {
|
@@ -3252,8 +3233,9 @@
|
|
3252
3233
|
}
|
3253
3234
|
return null;
|
3254
3235
|
}
|
3255
|
-
}
|
3256
|
-
|
3236
|
+
};
|
3237
|
+
new ("function" === typeof WeakMap ? WeakMap : Map)();
|
3238
|
+
var isArrayImpl = Array.isArray,
|
3257
3239
|
getPrototypeOf = Object.getPrototypeOf,
|
3258
3240
|
jsxPropsParents = new WeakMap(),
|
3259
3241
|
jsxChildrenParents = new WeakMap(),
|
@@ -3419,7 +3401,7 @@
|
|
3419
3401
|
try {
|
3420
3402
|
flushCompletedChunks(request, controller);
|
3421
3403
|
} catch (error$3) {
|
3422
|
-
logRecoverableError(request, error$3),
|
3404
|
+
logRecoverableError(request, error$3, null),
|
3423
3405
|
fatalError(request, error$3);
|
3424
3406
|
}
|
3425
3407
|
}
|