react-server-dom-webpack 19.0.0-rc-34d0c5e357-20240607 → 19.0.0-rc-a26e3f403e-20240611
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 +1796 -3248
- package/cjs/react-server-dom-webpack-client.browser.production.js +30 -22
- package/cjs/react-server-dom-webpack-client.edge.development.js +1983 -3524
- package/cjs/react-server-dom-webpack-client.edge.production.js +30 -25
- package/cjs/react-server-dom-webpack-client.node.development.js +1943 -3485
- package/cjs/react-server-dom-webpack-client.node.production.js +14 -20
- package/cjs/react-server-dom-webpack-client.node.unbundled.development.js +1896 -3416
- package/cjs/react-server-dom-webpack-client.node.unbundled.production.js +14 -20
- package/cjs/react-server-dom-webpack-server.browser.development.js +3271 -5184
- package/cjs/react-server-dom-webpack-server.browser.production.js +188 -110
- package/cjs/react-server-dom-webpack-server.edge.development.js +3272 -5188
- package/cjs/react-server-dom-webpack-server.edge.production.js +170 -111
- package/cjs/react-server-dom-webpack-server.node.development.js +3350 -5337
- package/cjs/react-server-dom-webpack-server.node.production.js +165 -117
- package/cjs/react-server-dom-webpack-server.node.unbundled.development.js +3315 -5264
- package/cjs/react-server-dom-webpack-server.node.unbundled.production.js +165 -117
- package/package.json +3 -3
@@ -10,7 +10,21 @@
|
|
10
10
|
|
11
11
|
"use strict";
|
12
12
|
var ReactDOM = require("react-dom"),
|
13
|
-
React = require("react")
|
13
|
+
React = require("react");
|
14
|
+
function handleErrorInNextTick(error) {
|
15
|
+
setTimeout(function () {
|
16
|
+
throw error;
|
17
|
+
});
|
18
|
+
}
|
19
|
+
var LocalPromise = Promise,
|
20
|
+
scheduleMicrotask =
|
21
|
+
"function" === typeof queueMicrotask
|
22
|
+
? queueMicrotask
|
23
|
+
: function (callback) {
|
24
|
+
LocalPromise.resolve(null)
|
25
|
+
.then(callback)
|
26
|
+
.catch(handleErrorInNextTick);
|
27
|
+
},
|
14
28
|
currentView = null,
|
15
29
|
writtenBytes = 0;
|
16
30
|
function writeChunkAndReturn(destination, chunk) {
|
@@ -677,12 +691,13 @@ if (!ReactSharedInternalsServer)
|
|
677
691
|
'The "react" package in this environment is not configured correctly. The "react-server" condition must be enabled in any environment that runs React Server Components.'
|
678
692
|
);
|
679
693
|
var ObjectPrototype = Object.prototype,
|
680
|
-
stringify = JSON.stringify
|
694
|
+
stringify = JSON.stringify,
|
695
|
+
AbortSigil = {};
|
681
696
|
function defaultErrorHandler(error) {
|
682
697
|
console.error(error);
|
683
698
|
}
|
684
699
|
function defaultPostponeHandler() {}
|
685
|
-
function
|
700
|
+
function RequestInstance(
|
686
701
|
model,
|
687
702
|
bundlerConfig,
|
688
703
|
onError,
|
@@ -700,37 +715,32 @@ function createRequest(
|
|
700
715
|
var abortSet = new Set();
|
701
716
|
environmentName = [];
|
702
717
|
var hints = new Set();
|
703
|
-
|
704
|
-
|
705
|
-
|
706
|
-
|
707
|
-
|
708
|
-
|
709
|
-
|
710
|
-
|
711
|
-
|
712
|
-
|
713
|
-
|
714
|
-
|
715
|
-
|
716
|
-
|
717
|
-
|
718
|
-
|
719
|
-
|
720
|
-
|
721
|
-
|
722
|
-
|
723
|
-
|
724
|
-
|
725
|
-
|
726
|
-
|
727
|
-
|
728
|
-
onError: void 0 === onError ? defaultErrorHandler : onError,
|
729
|
-
onPostpone: void 0 === onPostpone ? defaultPostponeHandler : onPostpone
|
730
|
-
};
|
731
|
-
model = createTask(bundlerConfig, model, null, !1, abortSet);
|
718
|
+
this.status = 0;
|
719
|
+
this.flushScheduled = !1;
|
720
|
+
this.destination = this.fatalError = null;
|
721
|
+
this.bundlerConfig = bundlerConfig;
|
722
|
+
this.cache = new Map();
|
723
|
+
this.pendingChunks = this.nextChunkId = 0;
|
724
|
+
this.hints = hints;
|
725
|
+
this.abortListeners = new Set();
|
726
|
+
this.abortableTasks = abortSet;
|
727
|
+
this.pingedTasks = environmentName;
|
728
|
+
this.completedImportChunks = [];
|
729
|
+
this.completedHintChunks = [];
|
730
|
+
this.completedRegularChunks = [];
|
731
|
+
this.completedErrorChunks = [];
|
732
|
+
this.writtenSymbols = new Map();
|
733
|
+
this.writtenClientReferences = new Map();
|
734
|
+
this.writtenServerReferences = new Map();
|
735
|
+
this.writtenObjects = new WeakMap();
|
736
|
+
this.temporaryReferences = temporaryReferences;
|
737
|
+
this.identifierPrefix = identifierPrefix || "";
|
738
|
+
this.identifierCount = 1;
|
739
|
+
this.taintCleanupQueue = [];
|
740
|
+
this.onError = void 0 === onError ? defaultErrorHandler : onError;
|
741
|
+
this.onPostpone = void 0 === onPostpone ? defaultPostponeHandler : onPostpone;
|
742
|
+
model = createTask(this, model, null, !1, abortSet);
|
732
743
|
environmentName.push(model);
|
733
|
-
return bundlerConfig;
|
734
744
|
}
|
735
745
|
var currentRequest = null;
|
736
746
|
function resolveRequest() {
|
@@ -761,6 +771,14 @@ function serializeThenable(request, task, thenable) {
|
|
761
771
|
newTask.id
|
762
772
|
);
|
763
773
|
default:
|
774
|
+
if (1 === request.status)
|
775
|
+
return (
|
776
|
+
(newTask.status = 3),
|
777
|
+
(task = stringify(serializeByValueID(request.fatalError))),
|
778
|
+
emitModelChunk(request, newTask.id, task),
|
779
|
+
request.abortableTasks.delete(newTask),
|
780
|
+
newTask.id
|
781
|
+
);
|
764
782
|
"string" !== typeof thenable.status &&
|
765
783
|
((thenable.status = "pending"),
|
766
784
|
thenable.then(
|
@@ -947,7 +965,12 @@ function renderFunctionComponent(request, task, key, Component, props) {
|
|
947
965
|
thenableIndexCounter = 0;
|
948
966
|
thenableState = prevThenableState;
|
949
967
|
Component = Component(props, void 0);
|
950
|
-
if (
|
968
|
+
if (1 === request.status) throw AbortSigil;
|
969
|
+
if (
|
970
|
+
"object" === typeof Component &&
|
971
|
+
null !== Component &&
|
972
|
+
Component.$$typeof !== CLIENT_REFERENCE_TAG$1
|
973
|
+
) {
|
951
974
|
if ("function" === typeof Component.then) {
|
952
975
|
props = Component;
|
953
976
|
if ("fulfilled" === props.status) return props.value;
|
@@ -1040,6 +1063,7 @@ function renderElement(request, task, type, key, ref, props) {
|
|
1040
1063
|
case REACT_LAZY_TYPE:
|
1041
1064
|
var init = type._init;
|
1042
1065
|
type = init(type._payload);
|
1066
|
+
if (1 === request.status) throw AbortSigil;
|
1043
1067
|
return renderElement(request, task, type, key, ref, props);
|
1044
1068
|
case REACT_FORWARD_REF_TYPE:
|
1045
1069
|
return renderFunctionComponent(request, task, key, type.render, props);
|
@@ -1056,9 +1080,9 @@ function pingTask(request, task) {
|
|
1056
1080
|
pingedTasks.push(task);
|
1057
1081
|
1 === pingedTasks.length &&
|
1058
1082
|
((request.flushScheduled = null !== request.destination),
|
1059
|
-
|
1083
|
+
scheduleMicrotask(function () {
|
1060
1084
|
return performWork(request);
|
1061
|
-
}
|
1085
|
+
}));
|
1062
1086
|
}
|
1063
1087
|
function createTask(request, model, keyPath, implicitSlot, abortSet) {
|
1064
1088
|
request.pendingChunks++;
|
@@ -1090,50 +1114,61 @@ function createTask(request, model, keyPath, implicitSlot, abortSet) {
|
|
1090
1114
|
);
|
1091
1115
|
} catch (thrownValue) {
|
1092
1116
|
if (
|
1093
|
-
((parentPropertyName =
|
1117
|
+
((parentPropertyName = task.model),
|
1118
|
+
(parentPropertyName =
|
1119
|
+
"object" === typeof parentPropertyName &&
|
1120
|
+
null !== parentPropertyName &&
|
1121
|
+
(parentPropertyName.$$typeof === REACT_ELEMENT_TYPE ||
|
1122
|
+
parentPropertyName.$$typeof === REACT_LAZY_TYPE)),
|
1123
|
+
(value =
|
1094
1124
|
thrownValue === SuspenseException
|
1095
1125
|
? getSuspendedThenable()
|
1096
1126
|
: thrownValue),
|
1097
|
-
|
1098
|
-
(value =
|
1099
|
-
"object" === typeof value &&
|
1127
|
+
"object" === typeof value &&
|
1100
1128
|
null !== value &&
|
1101
|
-
|
1102
|
-
|
1103
|
-
|
1104
|
-
|
1105
|
-
|
1106
|
-
|
1107
|
-
|
1108
|
-
|
1109
|
-
|
1110
|
-
|
1111
|
-
|
1112
|
-
|
1113
|
-
|
1114
|
-
|
1115
|
-
|
1116
|
-
|
1117
|
-
|
1118
|
-
|
1119
|
-
|
1120
|
-
|
1121
|
-
|
1122
|
-
|
1123
|
-
|
1129
|
+
"function" === typeof value.then)
|
1130
|
+
)
|
1131
|
+
if (1 === request.status)
|
1132
|
+
(task.status = 3),
|
1133
|
+
(prevKeyPath = request.fatalError),
|
1134
|
+
(JSCompiler_inline_result = parentPropertyName
|
1135
|
+
? "$L" + prevKeyPath.toString(16)
|
1136
|
+
: serializeByValueID(prevKeyPath));
|
1137
|
+
else {
|
1138
|
+
JSCompiler_inline_result = createTask(
|
1139
|
+
request,
|
1140
|
+
task.model,
|
1141
|
+
task.keyPath,
|
1142
|
+
task.implicitSlot,
|
1143
|
+
request.abortableTasks
|
1144
|
+
);
|
1145
|
+
var ping = JSCompiler_inline_result.ping;
|
1146
|
+
value.then(ping, ping);
|
1147
|
+
JSCompiler_inline_result.thenableState =
|
1148
|
+
getThenableStateAfterSuspending();
|
1149
|
+
task.keyPath = prevKeyPath;
|
1150
|
+
task.implicitSlot = prevImplicitSlot;
|
1151
|
+
JSCompiler_inline_result = parentPropertyName
|
1152
|
+
? "$L" + JSCompiler_inline_result.id.toString(16)
|
1153
|
+
: serializeByValueID(JSCompiler_inline_result.id);
|
1154
|
+
}
|
1155
|
+
else if (thrownValue === AbortSigil)
|
1156
|
+
(task.status = 3),
|
1157
|
+
(prevKeyPath = request.fatalError),
|
1158
|
+
(JSCompiler_inline_result = parentPropertyName
|
1159
|
+
? "$L" + prevKeyPath.toString(16)
|
1160
|
+
: serializeByValueID(prevKeyPath));
|
1161
|
+
else if (
|
1124
1162
|
((task.keyPath = prevKeyPath),
|
1125
1163
|
(task.implicitSlot = prevImplicitSlot),
|
1126
|
-
|
1164
|
+
parentPropertyName)
|
1127
1165
|
)
|
1128
1166
|
request.pendingChunks++,
|
1129
1167
|
(prevKeyPath = request.nextChunkId++),
|
1130
|
-
(prevImplicitSlot = logRecoverableError(
|
1131
|
-
request,
|
1132
|
-
parentPropertyName
|
1133
|
-
)),
|
1168
|
+
(prevImplicitSlot = logRecoverableError(request, value)),
|
1134
1169
|
emitErrorChunk(request, prevKeyPath, prevImplicitSlot),
|
1135
1170
|
(JSCompiler_inline_result = "$L" + prevKeyPath.toString(16));
|
1136
|
-
else throw
|
1171
|
+
else throw value;
|
1137
1172
|
}
|
1138
1173
|
return JSCompiler_inline_result;
|
1139
1174
|
},
|
@@ -1286,12 +1321,11 @@ function renderModelDestructive(
|
|
1286
1321
|
parentPropertyName
|
1287
1322
|
);
|
1288
1323
|
case REACT_LAZY_TYPE:
|
1289
|
-
|
1290
|
-
|
1291
|
-
|
1292
|
-
|
1293
|
-
|
1294
|
-
);
|
1324
|
+
task.thenableState = null;
|
1325
|
+
parentPropertyName = value._init;
|
1326
|
+
value = parentPropertyName(value._payload);
|
1327
|
+
if (1 === request.status) throw AbortSigil;
|
1328
|
+
return renderModelDestructive(request, task, emptyRoot, "", value);
|
1295
1329
|
case REACT_LEGACY_ELEMENT_TYPE:
|
1296
1330
|
throw Error(
|
1297
1331
|
'A React Element from an older version of React was rendered. This is not supported. It can happen if:\n- Multiple copies of the "react" package is used.\n- A library pre-bundled an old copy of "react" or "react/jsx-runtime".\n- A compiler tries to "inline" JSX instead of using the runtime.'
|
@@ -1554,8 +1588,8 @@ function logRecoverableError(request, error) {
|
|
1554
1588
|
}
|
1555
1589
|
function fatalError(request, error) {
|
1556
1590
|
null !== request.destination
|
1557
|
-
? ((request.status =
|
1558
|
-
: ((request.status =
|
1591
|
+
? ((request.status = 3), closeWithError(request.destination, error))
|
1592
|
+
: ((request.status = 2), (request.fatalError = error));
|
1559
1593
|
}
|
1560
1594
|
function emitErrorChunk(request, id, digest) {
|
1561
1595
|
digest = { digest: digest };
|
@@ -1624,7 +1658,8 @@ function emitChunk(request, task, value) {
|
|
1624
1658
|
}
|
1625
1659
|
var emptyRoot = {};
|
1626
1660
|
function retryTask(request, task) {
|
1627
|
-
if (0 === task.status)
|
1661
|
+
if (0 === task.status) {
|
1662
|
+
task.status = 5;
|
1628
1663
|
try {
|
1629
1664
|
modelRoot = task.model;
|
1630
1665
|
var resolvedModel = renderModelDestructive(
|
@@ -1651,10 +1686,23 @@ function retryTask(request, task) {
|
|
1651
1686
|
thrownValue === SuspenseException
|
1652
1687
|
? getSuspendedThenable()
|
1653
1688
|
: thrownValue;
|
1654
|
-
if ("object" === typeof x && null !== x && "function" === typeof x.then)
|
1655
|
-
|
1656
|
-
|
1657
|
-
|
1689
|
+
if ("object" === typeof x && null !== x && "function" === typeof x.then)
|
1690
|
+
if (1 === request.status) {
|
1691
|
+
request.abortableTasks.delete(task);
|
1692
|
+
task.status = 3;
|
1693
|
+
var model = stringify(serializeByValueID(request.fatalError));
|
1694
|
+
emitModelChunk(request, task.id, model);
|
1695
|
+
} else {
|
1696
|
+
task.status = 0;
|
1697
|
+
task.thenableState = getThenableStateAfterSuspending();
|
1698
|
+
var ping = task.ping;
|
1699
|
+
x.then(ping, ping);
|
1700
|
+
}
|
1701
|
+
else if (x === AbortSigil) {
|
1702
|
+
request.abortableTasks.delete(task);
|
1703
|
+
task.status = 3;
|
1704
|
+
var model$19 = stringify(serializeByValueID(request.fatalError));
|
1705
|
+
emitModelChunk(request, task.id, model$19);
|
1658
1706
|
} else {
|
1659
1707
|
request.abortableTasks.delete(task);
|
1660
1708
|
task.status = 4;
|
@@ -1663,6 +1711,7 @@ function retryTask(request, task) {
|
|
1663
1711
|
}
|
1664
1712
|
} finally {
|
1665
1713
|
}
|
1714
|
+
}
|
1666
1715
|
}
|
1667
1716
|
function performWork(request) {
|
1668
1717
|
var prevDispatcher = ReactSharedInternalsServer.H;
|
@@ -1720,7 +1769,7 @@ function flushCompletedChunks(request, destination) {
|
|
1720
1769
|
(writtenBytes = 0));
|
1721
1770
|
}
|
1722
1771
|
0 === request.pendingChunks &&
|
1723
|
-
(destination.close(), (request.destination = null));
|
1772
|
+
((request.status = 3), destination.close(), (request.destination = null));
|
1724
1773
|
}
|
1725
1774
|
function startWork(request) {
|
1726
1775
|
request.flushScheduled = null !== request.destination;
|
@@ -1733,53 +1782,63 @@ function startWork(request) {
|
|
1733
1782
|
}, 0);
|
1734
1783
|
}
|
1735
1784
|
function enqueueFlush(request) {
|
1736
|
-
|
1737
|
-
!1 === request.flushScheduled &&
|
1785
|
+
!1 === request.flushScheduled &&
|
1738
1786
|
0 === request.pingedTasks.length &&
|
1739
|
-
null !== request.destination
|
1740
|
-
|
1741
|
-
var destination = request.destination;
|
1742
|
-
request.flushScheduled = !0;
|
1787
|
+
null !== request.destination &&
|
1788
|
+
((request.flushScheduled = !0),
|
1743
1789
|
setTimeout(function () {
|
1744
|
-
|
1745
|
-
|
1746
|
-
|
1790
|
+
request.flushScheduled = !1;
|
1791
|
+
var destination = request.destination;
|
1792
|
+
destination && flushCompletedChunks(request, destination);
|
1793
|
+
}, 0));
|
1747
1794
|
}
|
1748
1795
|
function abort(request, reason) {
|
1749
1796
|
try {
|
1797
|
+
request.status = 1;
|
1750
1798
|
var abortableTasks = request.abortableTasks;
|
1751
1799
|
if (0 < abortableTasks.size) {
|
1752
1800
|
request.pendingChunks++;
|
1753
|
-
var errorId = request.nextChunkId
|
1754
|
-
|
1801
|
+
var errorId = request.nextChunkId++;
|
1802
|
+
request.fatalError = errorId;
|
1803
|
+
var error =
|
1755
1804
|
void 0 === reason
|
1756
1805
|
? Error("The render was aborted by the server without a reason.")
|
1806
|
+
: "object" === typeof reason &&
|
1807
|
+
null !== reason &&
|
1808
|
+
"function" === typeof reason.then
|
1809
|
+
? Error("The render was aborted by the server with a promise.")
|
1757
1810
|
: reason,
|
1758
1811
|
digest = logRecoverableError(request, error);
|
1759
1812
|
emitErrorChunk(request, errorId, digest, error);
|
1760
1813
|
abortableTasks.forEach(function (task) {
|
1761
|
-
task.status
|
1762
|
-
|
1763
|
-
|
1764
|
-
|
1814
|
+
if (5 !== task.status) {
|
1815
|
+
task.status = 3;
|
1816
|
+
var ref = serializeByValueID(errorId);
|
1817
|
+
task = encodeReferenceChunk(request, task.id, ref);
|
1818
|
+
request.completedErrorChunks.push(task);
|
1819
|
+
}
|
1765
1820
|
});
|
1766
1821
|
abortableTasks.clear();
|
1767
1822
|
}
|
1768
1823
|
var abortListeners = request.abortListeners;
|
1769
1824
|
if (0 < abortListeners.size) {
|
1770
|
-
var error$
|
1825
|
+
var error$26 =
|
1771
1826
|
void 0 === reason
|
1772
1827
|
? Error("The render was aborted by the server without a reason.")
|
1828
|
+
: "object" === typeof reason &&
|
1829
|
+
null !== reason &&
|
1830
|
+
"function" === typeof reason.then
|
1831
|
+
? Error("The render was aborted by the server with a promise.")
|
1773
1832
|
: reason;
|
1774
1833
|
abortListeners.forEach(function (callback) {
|
1775
|
-
return callback(error$
|
1834
|
+
return callback(error$26);
|
1776
1835
|
});
|
1777
1836
|
abortListeners.clear();
|
1778
1837
|
}
|
1779
1838
|
null !== request.destination &&
|
1780
1839
|
flushCompletedChunks(request, request.destination);
|
1781
|
-
} catch (error$
|
1782
|
-
logRecoverableError(request, error$
|
1840
|
+
} catch (error$27) {
|
1841
|
+
logRecoverableError(request, error$27), fatalError(request, error$27);
|
1783
1842
|
}
|
1784
1843
|
}
|
1785
1844
|
function resolveServerReference(bundlerConfig, id) {
|
@@ -2222,8 +2281,8 @@ function parseReadableStream(response, reference, type) {
|
|
2222
2281
|
(previousBlockedChunk = chunk));
|
2223
2282
|
} else {
|
2224
2283
|
chunk = previousBlockedChunk;
|
2225
|
-
var chunk$
|
2226
|
-
chunk$
|
2284
|
+
var chunk$30 = createPendingChunk(response);
|
2285
|
+
chunk$30.then(
|
2227
2286
|
function (v) {
|
2228
2287
|
return controller.enqueue(v);
|
2229
2288
|
},
|
@@ -2231,10 +2290,10 @@ function parseReadableStream(response, reference, type) {
|
|
2231
2290
|
return controller.error(e);
|
2232
2291
|
}
|
2233
2292
|
);
|
2234
|
-
previousBlockedChunk = chunk$
|
2293
|
+
previousBlockedChunk = chunk$30;
|
2235
2294
|
chunk.then(function () {
|
2236
|
-
previousBlockedChunk === chunk$
|
2237
|
-
resolveModelChunk(chunk$
|
2295
|
+
previousBlockedChunk === chunk$30 && (previousBlockedChunk = null);
|
2296
|
+
resolveModelChunk(chunk$30, json, -1);
|
2238
2297
|
});
|
2239
2298
|
}
|
2240
2299
|
},
|
@@ -2575,7 +2634,7 @@ exports.registerServerReference = function (reference, id, exportName) {
|
|
2575
2634
|
});
|
2576
2635
|
};
|
2577
2636
|
exports.renderToReadableStream = function (model, webpackMap, options) {
|
2578
|
-
var request =
|
2637
|
+
var request = new RequestInstance(
|
2579
2638
|
model,
|
2580
2639
|
webpackMap,
|
2581
2640
|
options ? options.onError : void 0,
|
@@ -2602,9 +2661,9 @@ exports.renderToReadableStream = function (model, webpackMap, options) {
|
|
2602
2661
|
startWork(request);
|
2603
2662
|
},
|
2604
2663
|
pull: function (controller) {
|
2605
|
-
if (
|
2606
|
-
(request.status =
|
2607
|
-
else if (
|
2664
|
+
if (2 === request.status)
|
2665
|
+
(request.status = 3), closeWithError(controller, request.fatalError);
|
2666
|
+
else if (3 !== request.status && null === request.destination) {
|
2608
2667
|
request.destination = controller;
|
2609
2668
|
try {
|
2610
2669
|
flushCompletedChunks(request, controller);
|