react-server-dom-webpack 19.0.0-rc-20b6f4c0e8-20240607 → 19.0.0-rc-34d0c5e357-20240607
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 +30 -61
- package/cjs/react-server-dom-webpack-client.edge.development.js +30 -61
- package/cjs/react-server-dom-webpack-client.node.development.js +31 -62
- package/cjs/react-server-dom-webpack-client.node.unbundled.development.js +31 -62
- package/cjs/react-server-dom-webpack-server.browser.development.js +47 -241
- package/cjs/react-server-dom-webpack-server.browser.production.js +78 -161
- package/cjs/react-server-dom-webpack-server.edge.development.js +46 -227
- package/cjs/react-server-dom-webpack-server.edge.production.js +79 -143
- package/cjs/react-server-dom-webpack-server.node.development.js +47 -219
- package/cjs/react-server-dom-webpack-server.node.production.js +85 -138
- package/cjs/react-server-dom-webpack-server.node.unbundled.development.js +47 -219
- package/cjs/react-server-dom-webpack-server.node.unbundled.production.js +85 -138
- package/package.json +3 -3
@@ -11,30 +11,6 @@
|
|
11
11
|
"use strict";
|
12
12
|
var ReactDOM = require("react-dom"),
|
13
13
|
React = require("react"),
|
14
|
-
channel = new MessageChannel(),
|
15
|
-
taskQueue = [];
|
16
|
-
channel.port1.onmessage = function () {
|
17
|
-
var task = taskQueue.shift();
|
18
|
-
task && task();
|
19
|
-
};
|
20
|
-
function scheduleWork(callback) {
|
21
|
-
taskQueue.push(callback);
|
22
|
-
channel.port2.postMessage(null);
|
23
|
-
}
|
24
|
-
function handleErrorInNextTick(error) {
|
25
|
-
setTimeout(function () {
|
26
|
-
throw error;
|
27
|
-
});
|
28
|
-
}
|
29
|
-
var LocalPromise = Promise,
|
30
|
-
scheduleMicrotask =
|
31
|
-
"function" === typeof queueMicrotask
|
32
|
-
? queueMicrotask
|
33
|
-
: function (callback) {
|
34
|
-
LocalPromise.resolve(null)
|
35
|
-
.then(callback)
|
36
|
-
.catch(handleErrorInNextTick);
|
37
|
-
},
|
38
14
|
currentView = null,
|
39
15
|
writtenBytes = 0;
|
40
16
|
function writeChunkAndReturn(destination, chunk) {
|
@@ -694,8 +670,7 @@ if (!ReactSharedInternalsServer)
|
|
694
670
|
'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.'
|
695
671
|
);
|
696
672
|
var ObjectPrototype = Object.prototype,
|
697
|
-
stringify = JSON.stringify
|
698
|
-
AbortSigil = {};
|
673
|
+
stringify = JSON.stringify;
|
699
674
|
function defaultErrorHandler(error) {
|
700
675
|
console.error(error);
|
701
676
|
}
|
@@ -771,14 +746,6 @@ function serializeThenable(request, task, thenable) {
|
|
771
746
|
newTask.id
|
772
747
|
);
|
773
748
|
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
|
-
);
|
782
749
|
"string" !== typeof thenable.status &&
|
783
750
|
((thenable.status = "pending"),
|
784
751
|
thenable.then(
|
@@ -965,12 +932,7 @@ function renderFunctionComponent(request, task, key, Component, props) {
|
|
965
932
|
thenableIndexCounter = 0;
|
966
933
|
thenableState = prevThenableState;
|
967
934
|
Component = Component(props, void 0);
|
968
|
-
if (
|
969
|
-
if (
|
970
|
-
"object" === typeof Component &&
|
971
|
-
null !== Component &&
|
972
|
-
Component.$$typeof !== CLIENT_REFERENCE_TAG$1
|
973
|
-
) {
|
935
|
+
if ("object" === typeof Component && null !== Component) {
|
974
936
|
if ("function" === typeof Component.then) {
|
975
937
|
props = Component;
|
976
938
|
if ("fulfilled" === props.status) return props.value;
|
@@ -1063,7 +1025,6 @@ function renderElement(request, task, type, key, ref, props) {
|
|
1063
1025
|
case REACT_LAZY_TYPE:
|
1064
1026
|
var init = type._init;
|
1065
1027
|
type = init(type._payload);
|
1066
|
-
if (1 === request.status) throw AbortSigil;
|
1067
1028
|
return renderElement(request, task, type, key, ref, props);
|
1068
1029
|
case REACT_FORWARD_REF_TYPE:
|
1069
1030
|
return renderFunctionComponent(request, task, key, type.render, props);
|
@@ -1080,9 +1041,7 @@ function pingTask(request, task) {
|
|
1080
1041
|
pingedTasks.push(task);
|
1081
1042
|
1 === pingedTasks.length &&
|
1082
1043
|
((request.flushScheduled = null !== request.destination),
|
1083
|
-
|
1084
|
-
return performWork(request);
|
1085
|
-
}));
|
1044
|
+
performWork(request));
|
1086
1045
|
}
|
1087
1046
|
function createTask(request, model, keyPath, implicitSlot, abortSet) {
|
1088
1047
|
request.pendingChunks++;
|
@@ -1114,61 +1073,50 @@ function createTask(request, model, keyPath, implicitSlot, abortSet) {
|
|
1114
1073
|
);
|
1115
1074
|
} catch (thrownValue) {
|
1116
1075
|
if (
|
1117
|
-
((parentPropertyName =
|
1118
|
-
(parentPropertyName =
|
1119
|
-
"object" === typeof parentPropertyName &&
|
1120
|
-
null !== parentPropertyName &&
|
1121
|
-
(parentPropertyName.$$typeof === REACT_ELEMENT_TYPE ||
|
1122
|
-
parentPropertyName.$$typeof === REACT_LAZY_TYPE)),
|
1123
|
-
(value =
|
1076
|
+
((parentPropertyName =
|
1124
1077
|
thrownValue === SuspenseException
|
1125
1078
|
? getSuspendedThenable()
|
1126
1079
|
: thrownValue),
|
1127
|
-
|
1080
|
+
(value = task.model),
|
1081
|
+
(value =
|
1082
|
+
"object" === typeof value &&
|
1128
1083
|
null !== value &&
|
1129
|
-
|
1130
|
-
|
1131
|
-
|
1132
|
-
|
1133
|
-
|
1134
|
-
|
1135
|
-
|
1136
|
-
|
1137
|
-
|
1138
|
-
|
1139
|
-
|
1140
|
-
|
1141
|
-
|
1142
|
-
|
1143
|
-
|
1144
|
-
|
1145
|
-
|
1146
|
-
|
1147
|
-
|
1148
|
-
|
1149
|
-
|
1150
|
-
|
1151
|
-
|
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 (
|
1084
|
+
(value.$$typeof === REACT_ELEMENT_TYPE ||
|
1085
|
+
value.$$typeof === REACT_LAZY_TYPE)),
|
1086
|
+
"object" === typeof parentPropertyName &&
|
1087
|
+
null !== parentPropertyName &&
|
1088
|
+
"function" === typeof parentPropertyName.then)
|
1089
|
+
) {
|
1090
|
+
JSCompiler_inline_result = createTask(
|
1091
|
+
request,
|
1092
|
+
task.model,
|
1093
|
+
task.keyPath,
|
1094
|
+
task.implicitSlot,
|
1095
|
+
request.abortableTasks
|
1096
|
+
);
|
1097
|
+
var ping = JSCompiler_inline_result.ping;
|
1098
|
+
parentPropertyName.then(ping, ping);
|
1099
|
+
JSCompiler_inline_result.thenableState =
|
1100
|
+
getThenableStateAfterSuspending();
|
1101
|
+
task.keyPath = prevKeyPath;
|
1102
|
+
task.implicitSlot = prevImplicitSlot;
|
1103
|
+
JSCompiler_inline_result = value
|
1104
|
+
? "$L" + JSCompiler_inline_result.id.toString(16)
|
1105
|
+
: serializeByValueID(JSCompiler_inline_result.id);
|
1106
|
+
} else if (
|
1162
1107
|
((task.keyPath = prevKeyPath),
|
1163
1108
|
(task.implicitSlot = prevImplicitSlot),
|
1164
|
-
|
1109
|
+
value)
|
1165
1110
|
)
|
1166
1111
|
request.pendingChunks++,
|
1167
1112
|
(prevKeyPath = request.nextChunkId++),
|
1168
|
-
(prevImplicitSlot = logRecoverableError(
|
1113
|
+
(prevImplicitSlot = logRecoverableError(
|
1114
|
+
request,
|
1115
|
+
parentPropertyName
|
1116
|
+
)),
|
1169
1117
|
emitErrorChunk(request, prevKeyPath, prevImplicitSlot),
|
1170
1118
|
(JSCompiler_inline_result = "$L" + prevKeyPath.toString(16));
|
1171
|
-
else throw
|
1119
|
+
else throw parentPropertyName;
|
1172
1120
|
}
|
1173
1121
|
return JSCompiler_inline_result;
|
1174
1122
|
},
|
@@ -1321,11 +1269,12 @@ function renderModelDestructive(
|
|
1321
1269
|
parentPropertyName
|
1322
1270
|
);
|
1323
1271
|
case REACT_LAZY_TYPE:
|
1324
|
-
|
1325
|
-
|
1326
|
-
|
1327
|
-
|
1328
|
-
|
1272
|
+
return (
|
1273
|
+
(task.thenableState = null),
|
1274
|
+
(parentPropertyName = value._init),
|
1275
|
+
(value = parentPropertyName(value._payload)),
|
1276
|
+
renderModelDestructive(request, task, emptyRoot, "", value)
|
1277
|
+
);
|
1329
1278
|
case REACT_LEGACY_ELEMENT_TYPE:
|
1330
1279
|
throw Error(
|
1331
1280
|
'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.'
|
@@ -1586,8 +1535,8 @@ function logRecoverableError(request, error) {
|
|
1586
1535
|
}
|
1587
1536
|
function fatalError(request, error) {
|
1588
1537
|
null !== request.destination
|
1589
|
-
? ((request.status =
|
1590
|
-
: ((request.status =
|
1538
|
+
? ((request.status = 2), closeWithError(request.destination, error))
|
1539
|
+
: ((request.status = 1), (request.fatalError = error));
|
1591
1540
|
}
|
1592
1541
|
function emitErrorChunk(request, id, digest) {
|
1593
1542
|
digest = { digest: digest };
|
@@ -1656,8 +1605,7 @@ function emitChunk(request, task, value) {
|
|
1656
1605
|
}
|
1657
1606
|
var emptyRoot = {};
|
1658
1607
|
function retryTask(request, task) {
|
1659
|
-
if (0 === task.status)
|
1660
|
-
task.status = 5;
|
1608
|
+
if (0 === task.status)
|
1661
1609
|
try {
|
1662
1610
|
modelRoot = task.model;
|
1663
1611
|
var resolvedModel = renderModelDestructive(
|
@@ -1684,23 +1632,10 @@ function retryTask(request, task) {
|
|
1684
1632
|
thrownValue === SuspenseException
|
1685
1633
|
? getSuspendedThenable()
|
1686
1634
|
: thrownValue;
|
1687
|
-
if ("object" === typeof x && null !== x && "function" === typeof x.then)
|
1688
|
-
|
1689
|
-
|
1690
|
-
|
1691
|
-
var model = stringify(serializeByValueID(request.fatalError));
|
1692
|
-
emitModelChunk(request, task.id, model);
|
1693
|
-
} else {
|
1694
|
-
task.status = 0;
|
1695
|
-
task.thenableState = getThenableStateAfterSuspending();
|
1696
|
-
var ping = task.ping;
|
1697
|
-
x.then(ping, ping);
|
1698
|
-
}
|
1699
|
-
else if (x === AbortSigil) {
|
1700
|
-
request.abortableTasks.delete(task);
|
1701
|
-
task.status = 3;
|
1702
|
-
var model$19 = stringify(serializeByValueID(request.fatalError));
|
1703
|
-
emitModelChunk(request, task.id, model$19);
|
1635
|
+
if ("object" === typeof x && null !== x && "function" === typeof x.then) {
|
1636
|
+
var ping = task.ping;
|
1637
|
+
x.then(ping, ping);
|
1638
|
+
task.thenableState = getThenableStateAfterSuspending();
|
1704
1639
|
} else {
|
1705
1640
|
request.abortableTasks.delete(task);
|
1706
1641
|
task.status = 4;
|
@@ -1709,7 +1644,6 @@ function retryTask(request, task) {
|
|
1709
1644
|
}
|
1710
1645
|
} finally {
|
1711
1646
|
}
|
1712
|
-
}
|
1713
1647
|
}
|
1714
1648
|
function performWork(request) {
|
1715
1649
|
var prevDispatcher = ReactSharedInternalsServer.H;
|
@@ -1767,72 +1701,54 @@ function flushCompletedChunks(request, destination) {
|
|
1767
1701
|
(writtenBytes = 0));
|
1768
1702
|
}
|
1769
1703
|
0 === request.pendingChunks &&
|
1770
|
-
(
|
1771
|
-
}
|
1772
|
-
function startWork(request) {
|
1773
|
-
request.flushScheduled = null !== request.destination;
|
1774
|
-
scheduleWork(function () {
|
1775
|
-
return performWork(request);
|
1776
|
-
});
|
1704
|
+
(destination.close(), (request.destination = null));
|
1777
1705
|
}
|
1778
1706
|
function enqueueFlush(request) {
|
1779
|
-
|
1707
|
+
if (
|
1708
|
+
!1 === request.flushScheduled &&
|
1780
1709
|
0 === request.pingedTasks.length &&
|
1781
|
-
null !== request.destination
|
1782
|
-
|
1783
|
-
|
1784
|
-
|
1785
|
-
|
1786
|
-
|
1787
|
-
}));
|
1710
|
+
null !== request.destination
|
1711
|
+
) {
|
1712
|
+
var destination = request.destination;
|
1713
|
+
request.flushScheduled = !0;
|
1714
|
+
flushCompletedChunks(request, destination);
|
1715
|
+
}
|
1788
1716
|
}
|
1789
1717
|
function abort(request, reason) {
|
1790
1718
|
try {
|
1791
|
-
request.status = 1;
|
1792
1719
|
var abortableTasks = request.abortableTasks;
|
1793
1720
|
if (0 < abortableTasks.size) {
|
1794
1721
|
request.pendingChunks++;
|
1795
|
-
var errorId = request.nextChunkId
|
1796
|
-
|
1797
|
-
var error =
|
1722
|
+
var errorId = request.nextChunkId++,
|
1723
|
+
error =
|
1798
1724
|
void 0 === reason
|
1799
1725
|
? Error("The render was aborted by the server without a reason.")
|
1800
|
-
: "object" === typeof reason &&
|
1801
|
-
null !== reason &&
|
1802
|
-
"function" === typeof reason.then
|
1803
|
-
? Error("The render was aborted by the server with a promise.")
|
1804
1726
|
: reason,
|
1805
1727
|
digest = logRecoverableError(request, error);
|
1806
1728
|
emitErrorChunk(request, errorId, digest, error);
|
1807
1729
|
abortableTasks.forEach(function (task) {
|
1808
|
-
|
1809
|
-
|
1810
|
-
|
1811
|
-
|
1812
|
-
request.completedErrorChunks.push(task);
|
1813
|
-
}
|
1730
|
+
task.status = 3;
|
1731
|
+
var ref = serializeByValueID(errorId);
|
1732
|
+
task = encodeReferenceChunk(request, task.id, ref);
|
1733
|
+
request.completedErrorChunks.push(task);
|
1814
1734
|
});
|
1815
1735
|
abortableTasks.clear();
|
1816
1736
|
}
|
1817
1737
|
var abortListeners = request.abortListeners;
|
1818
1738
|
if (0 < abortListeners.size) {
|
1819
|
-
var error$
|
1739
|
+
var error$22 =
|
1820
1740
|
void 0 === reason
|
1821
1741
|
? Error("The render was aborted by the server without a reason.")
|
1822
|
-
: "object" === typeof reason &&
|
1823
|
-
null !== reason &&
|
1824
|
-
"function" === typeof reason.then
|
1825
|
-
? Error("The render was aborted by the server with a promise.")
|
1826
1742
|
: reason;
|
1827
1743
|
abortListeners.forEach(function (callback) {
|
1828
|
-
return callback(error$
|
1744
|
+
return callback(error$22);
|
1829
1745
|
});
|
1830
1746
|
abortListeners.clear();
|
1831
1747
|
}
|
1832
1748
|
null !== request.destination &&
|
1833
1749
|
flushCompletedChunks(request, request.destination);
|
1834
|
-
} catch (error$
|
1835
|
-
logRecoverableError(request, error$
|
1750
|
+
} catch (error$23) {
|
1751
|
+
logRecoverableError(request, error$23), fatalError(request, error$23);
|
1836
1752
|
}
|
1837
1753
|
}
|
1838
1754
|
function resolveServerReference(bundlerConfig, id) {
|
@@ -2284,8 +2200,8 @@ function parseReadableStream(response, reference, type) {
|
|
2284
2200
|
(previousBlockedChunk = chunk));
|
2285
2201
|
} else {
|
2286
2202
|
chunk = previousBlockedChunk;
|
2287
|
-
var chunk$
|
2288
|
-
chunk$
|
2203
|
+
var chunk$26 = createPendingChunk(response);
|
2204
|
+
chunk$26.then(
|
2289
2205
|
function (v) {
|
2290
2206
|
return controller.enqueue(v);
|
2291
2207
|
},
|
@@ -2293,10 +2209,10 @@ function parseReadableStream(response, reference, type) {
|
|
2293
2209
|
return controller.error(e);
|
2294
2210
|
}
|
2295
2211
|
);
|
2296
|
-
previousBlockedChunk = chunk$
|
2212
|
+
previousBlockedChunk = chunk$26;
|
2297
2213
|
chunk.then(function () {
|
2298
|
-
previousBlockedChunk === chunk$
|
2299
|
-
resolveModelChunk(chunk$
|
2214
|
+
previousBlockedChunk === chunk$26 && (previousBlockedChunk = null);
|
2215
|
+
resolveModelChunk(chunk$26, json, -1);
|
2300
2216
|
});
|
2301
2217
|
}
|
2302
2218
|
},
|
@@ -2661,12 +2577,13 @@ exports.renderToReadableStream = function (model, webpackMap, options) {
|
|
2661
2577
|
{
|
2662
2578
|
type: "bytes",
|
2663
2579
|
start: function () {
|
2664
|
-
|
2580
|
+
request.flushScheduled = null !== request.destination;
|
2581
|
+
performWork(request);
|
2665
2582
|
},
|
2666
2583
|
pull: function (controller) {
|
2667
|
-
if (
|
2668
|
-
(request.status =
|
2669
|
-
else if (
|
2584
|
+
if (1 === request.status)
|
2585
|
+
(request.status = 2), closeWithError(controller, request.fatalError);
|
2586
|
+
else if (2 !== request.status && null === request.destination) {
|
2670
2587
|
request.destination = controller;
|
2671
2588
|
try {
|
2672
2589
|
flushCompletedChunks(request, controller);
|