react-server-dom-webpack 19.0.0-rc-a532d91d01-20240610 → 19.0.0-rc-6230622a1a-20240610
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 +3270 -1796
- package/cjs/react-server-dom-webpack-client.edge.development.js +3546 -1985
- package/cjs/react-server-dom-webpack-client.node.development.js +3508 -1957
- package/cjs/react-server-dom-webpack-client.node.unbundled.development.js +3435 -1906
- package/cjs/react-server-dom-webpack-server.browser.development.js +5254 -3276
- package/cjs/react-server-dom-webpack-server.browser.production.js +77 -156
- package/cjs/react-server-dom-webpack-server.edge.development.js +5265 -3284
- package/cjs/react-server-dom-webpack-server.edge.production.js +78 -138
- package/cjs/react-server-dom-webpack-server.node.development.js +5401 -3349
- package/cjs/react-server-dom-webpack-server.node.production.js +84 -133
- package/cjs/react-server-dom-webpack-server.node.unbundled.development.js +5336 -3322
- package/cjs/react-server-dom-webpack-server.node.unbundled.production.js +84 -133
- 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,7 +932,6 @@ function renderFunctionComponent(request, task, key, Component, props) {
|
|
965
932
|
thenableIndexCounter = 0;
|
966
933
|
thenableState = prevThenableState;
|
967
934
|
Component = Component(props, void 0);
|
968
|
-
if (1 === request.status) throw AbortSigil;
|
969
935
|
if (
|
970
936
|
"object" === typeof Component &&
|
971
937
|
null !== Component &&
|
@@ -1063,7 +1029,6 @@ function renderElement(request, task, type, key, ref, props) {
|
|
1063
1029
|
case REACT_LAZY_TYPE:
|
1064
1030
|
var init = type._init;
|
1065
1031
|
type = init(type._payload);
|
1066
|
-
if (1 === request.status) throw AbortSigil;
|
1067
1032
|
return renderElement(request, task, type, key, ref, props);
|
1068
1033
|
case REACT_FORWARD_REF_TYPE:
|
1069
1034
|
return renderFunctionComponent(request, task, key, type.render, props);
|
@@ -1080,9 +1045,7 @@ function pingTask(request, task) {
|
|
1080
1045
|
pingedTasks.push(task);
|
1081
1046
|
1 === pingedTasks.length &&
|
1082
1047
|
((request.flushScheduled = null !== request.destination),
|
1083
|
-
|
1084
|
-
return performWork(request);
|
1085
|
-
}));
|
1048
|
+
performWork(request));
|
1086
1049
|
}
|
1087
1050
|
function createTask(request, model, keyPath, implicitSlot, abortSet) {
|
1088
1051
|
request.pendingChunks++;
|
@@ -1114,61 +1077,50 @@ function createTask(request, model, keyPath, implicitSlot, abortSet) {
|
|
1114
1077
|
);
|
1115
1078
|
} catch (thrownValue) {
|
1116
1079
|
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 =
|
1080
|
+
((parentPropertyName =
|
1124
1081
|
thrownValue === SuspenseException
|
1125
1082
|
? getSuspendedThenable()
|
1126
1083
|
: thrownValue),
|
1127
|
-
|
1084
|
+
(value = task.model),
|
1085
|
+
(value =
|
1086
|
+
"object" === typeof value &&
|
1128
1087
|
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 (
|
1088
|
+
(value.$$typeof === REACT_ELEMENT_TYPE ||
|
1089
|
+
value.$$typeof === REACT_LAZY_TYPE)),
|
1090
|
+
"object" === typeof parentPropertyName &&
|
1091
|
+
null !== parentPropertyName &&
|
1092
|
+
"function" === typeof parentPropertyName.then)
|
1093
|
+
) {
|
1094
|
+
JSCompiler_inline_result = createTask(
|
1095
|
+
request,
|
1096
|
+
task.model,
|
1097
|
+
task.keyPath,
|
1098
|
+
task.implicitSlot,
|
1099
|
+
request.abortableTasks
|
1100
|
+
);
|
1101
|
+
var ping = JSCompiler_inline_result.ping;
|
1102
|
+
parentPropertyName.then(ping, ping);
|
1103
|
+
JSCompiler_inline_result.thenableState =
|
1104
|
+
getThenableStateAfterSuspending();
|
1105
|
+
task.keyPath = prevKeyPath;
|
1106
|
+
task.implicitSlot = prevImplicitSlot;
|
1107
|
+
JSCompiler_inline_result = value
|
1108
|
+
? "$L" + JSCompiler_inline_result.id.toString(16)
|
1109
|
+
: serializeByValueID(JSCompiler_inline_result.id);
|
1110
|
+
} else if (
|
1162
1111
|
((task.keyPath = prevKeyPath),
|
1163
1112
|
(task.implicitSlot = prevImplicitSlot),
|
1164
|
-
|
1113
|
+
value)
|
1165
1114
|
)
|
1166
1115
|
request.pendingChunks++,
|
1167
1116
|
(prevKeyPath = request.nextChunkId++),
|
1168
|
-
(prevImplicitSlot = logRecoverableError(
|
1117
|
+
(prevImplicitSlot = logRecoverableError(
|
1118
|
+
request,
|
1119
|
+
parentPropertyName
|
1120
|
+
)),
|
1169
1121
|
emitErrorChunk(request, prevKeyPath, prevImplicitSlot),
|
1170
1122
|
(JSCompiler_inline_result = "$L" + prevKeyPath.toString(16));
|
1171
|
-
else throw
|
1123
|
+
else throw parentPropertyName;
|
1172
1124
|
}
|
1173
1125
|
return JSCompiler_inline_result;
|
1174
1126
|
},
|
@@ -1321,11 +1273,12 @@ function renderModelDestructive(
|
|
1321
1273
|
parentPropertyName
|
1322
1274
|
);
|
1323
1275
|
case REACT_LAZY_TYPE:
|
1324
|
-
|
1325
|
-
|
1326
|
-
|
1327
|
-
|
1328
|
-
|
1276
|
+
return (
|
1277
|
+
(task.thenableState = null),
|
1278
|
+
(parentPropertyName = value._init),
|
1279
|
+
(value = parentPropertyName(value._payload)),
|
1280
|
+
renderModelDestructive(request, task, emptyRoot, "", value)
|
1281
|
+
);
|
1329
1282
|
case REACT_LEGACY_ELEMENT_TYPE:
|
1330
1283
|
throw Error(
|
1331
1284
|
'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 +1539,8 @@ function logRecoverableError(request, error) {
|
|
1586
1539
|
}
|
1587
1540
|
function fatalError(request, error) {
|
1588
1541
|
null !== request.destination
|
1589
|
-
? ((request.status =
|
1590
|
-
: ((request.status =
|
1542
|
+
? ((request.status = 2), closeWithError(request.destination, error))
|
1543
|
+
: ((request.status = 1), (request.fatalError = error));
|
1591
1544
|
}
|
1592
1545
|
function emitErrorChunk(request, id, digest) {
|
1593
1546
|
digest = { digest: digest };
|
@@ -1656,8 +1609,7 @@ function emitChunk(request, task, value) {
|
|
1656
1609
|
}
|
1657
1610
|
var emptyRoot = {};
|
1658
1611
|
function retryTask(request, task) {
|
1659
|
-
if (0 === task.status)
|
1660
|
-
task.status = 5;
|
1612
|
+
if (0 === task.status)
|
1661
1613
|
try {
|
1662
1614
|
modelRoot = task.model;
|
1663
1615
|
var resolvedModel = renderModelDestructive(
|
@@ -1684,23 +1636,10 @@ function retryTask(request, task) {
|
|
1684
1636
|
thrownValue === SuspenseException
|
1685
1637
|
? getSuspendedThenable()
|
1686
1638
|
: 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);
|
1639
|
+
if ("object" === typeof x && null !== x && "function" === typeof x.then) {
|
1640
|
+
var ping = task.ping;
|
1641
|
+
x.then(ping, ping);
|
1642
|
+
task.thenableState = getThenableStateAfterSuspending();
|
1704
1643
|
} else {
|
1705
1644
|
request.abortableTasks.delete(task);
|
1706
1645
|
task.status = 4;
|
@@ -1709,7 +1648,6 @@ function retryTask(request, task) {
|
|
1709
1648
|
}
|
1710
1649
|
} finally {
|
1711
1650
|
}
|
1712
|
-
}
|
1713
1651
|
}
|
1714
1652
|
function performWork(request) {
|
1715
1653
|
var prevDispatcher = ReactSharedInternalsServer.H;
|
@@ -1767,72 +1705,54 @@ function flushCompletedChunks(request, destination) {
|
|
1767
1705
|
(writtenBytes = 0));
|
1768
1706
|
}
|
1769
1707
|
0 === request.pendingChunks &&
|
1770
|
-
(
|
1771
|
-
}
|
1772
|
-
function startWork(request) {
|
1773
|
-
request.flushScheduled = null !== request.destination;
|
1774
|
-
scheduleWork(function () {
|
1775
|
-
return performWork(request);
|
1776
|
-
});
|
1708
|
+
(destination.close(), (request.destination = null));
|
1777
1709
|
}
|
1778
1710
|
function enqueueFlush(request) {
|
1779
|
-
|
1711
|
+
if (
|
1712
|
+
!1 === request.flushScheduled &&
|
1780
1713
|
0 === request.pingedTasks.length &&
|
1781
|
-
null !== request.destination
|
1782
|
-
|
1783
|
-
|
1784
|
-
|
1785
|
-
|
1786
|
-
|
1787
|
-
}));
|
1714
|
+
null !== request.destination
|
1715
|
+
) {
|
1716
|
+
var destination = request.destination;
|
1717
|
+
request.flushScheduled = !0;
|
1718
|
+
flushCompletedChunks(request, destination);
|
1719
|
+
}
|
1788
1720
|
}
|
1789
1721
|
function abort(request, reason) {
|
1790
1722
|
try {
|
1791
|
-
request.status = 1;
|
1792
1723
|
var abortableTasks = request.abortableTasks;
|
1793
1724
|
if (0 < abortableTasks.size) {
|
1794
1725
|
request.pendingChunks++;
|
1795
|
-
var errorId = request.nextChunkId
|
1796
|
-
|
1797
|
-
var error =
|
1726
|
+
var errorId = request.nextChunkId++,
|
1727
|
+
error =
|
1798
1728
|
void 0 === reason
|
1799
1729
|
? 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
1730
|
: reason,
|
1805
1731
|
digest = logRecoverableError(request, error);
|
1806
1732
|
emitErrorChunk(request, errorId, digest, error);
|
1807
1733
|
abortableTasks.forEach(function (task) {
|
1808
|
-
|
1809
|
-
|
1810
|
-
|
1811
|
-
|
1812
|
-
request.completedErrorChunks.push(task);
|
1813
|
-
}
|
1734
|
+
task.status = 3;
|
1735
|
+
var ref = serializeByValueID(errorId);
|
1736
|
+
task = encodeReferenceChunk(request, task.id, ref);
|
1737
|
+
request.completedErrorChunks.push(task);
|
1814
1738
|
});
|
1815
1739
|
abortableTasks.clear();
|
1816
1740
|
}
|
1817
1741
|
var abortListeners = request.abortListeners;
|
1818
1742
|
if (0 < abortListeners.size) {
|
1819
|
-
var error$
|
1743
|
+
var error$22 =
|
1820
1744
|
void 0 === reason
|
1821
1745
|
? 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
1746
|
: reason;
|
1827
1747
|
abortListeners.forEach(function (callback) {
|
1828
|
-
return callback(error$
|
1748
|
+
return callback(error$22);
|
1829
1749
|
});
|
1830
1750
|
abortListeners.clear();
|
1831
1751
|
}
|
1832
1752
|
null !== request.destination &&
|
1833
1753
|
flushCompletedChunks(request, request.destination);
|
1834
|
-
} catch (error$
|
1835
|
-
logRecoverableError(request, error$
|
1754
|
+
} catch (error$23) {
|
1755
|
+
logRecoverableError(request, error$23), fatalError(request, error$23);
|
1836
1756
|
}
|
1837
1757
|
}
|
1838
1758
|
function resolveServerReference(bundlerConfig, id) {
|
@@ -2284,8 +2204,8 @@ function parseReadableStream(response, reference, type) {
|
|
2284
2204
|
(previousBlockedChunk = chunk));
|
2285
2205
|
} else {
|
2286
2206
|
chunk = previousBlockedChunk;
|
2287
|
-
var chunk$
|
2288
|
-
chunk$
|
2207
|
+
var chunk$26 = createPendingChunk(response);
|
2208
|
+
chunk$26.then(
|
2289
2209
|
function (v) {
|
2290
2210
|
return controller.enqueue(v);
|
2291
2211
|
},
|
@@ -2293,10 +2213,10 @@ function parseReadableStream(response, reference, type) {
|
|
2293
2213
|
return controller.error(e);
|
2294
2214
|
}
|
2295
2215
|
);
|
2296
|
-
previousBlockedChunk = chunk$
|
2216
|
+
previousBlockedChunk = chunk$26;
|
2297
2217
|
chunk.then(function () {
|
2298
|
-
previousBlockedChunk === chunk$
|
2299
|
-
resolveModelChunk(chunk$
|
2218
|
+
previousBlockedChunk === chunk$26 && (previousBlockedChunk = null);
|
2219
|
+
resolveModelChunk(chunk$26, json, -1);
|
2300
2220
|
});
|
2301
2221
|
}
|
2302
2222
|
},
|
@@ -2661,12 +2581,13 @@ exports.renderToReadableStream = function (model, webpackMap, options) {
|
|
2661
2581
|
{
|
2662
2582
|
type: "bytes",
|
2663
2583
|
start: function () {
|
2664
|
-
|
2584
|
+
request.flushScheduled = null !== request.destination;
|
2585
|
+
performWork(request);
|
2665
2586
|
},
|
2666
2587
|
pull: function (controller) {
|
2667
|
-
if (
|
2668
|
-
(request.status =
|
2669
|
-
else if (
|
2588
|
+
if (1 === request.status)
|
2589
|
+
(request.status = 2), closeWithError(controller, request.fatalError);
|
2590
|
+
else if (2 !== request.status && null === request.destination) {
|
2670
2591
|
request.destination = controller;
|
2671
2592
|
try {
|
2672
2593
|
flushCompletedChunks(request, controller);
|