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
@@ -11,6 +11,30 @@
|
|
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
|
+
},
|
14
38
|
currentView = null,
|
15
39
|
writtenBytes = 0;
|
16
40
|
function writeChunkAndReturn(destination, chunk) {
|
@@ -670,12 +694,13 @@ if (!ReactSharedInternalsServer)
|
|
670
694
|
'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.'
|
671
695
|
);
|
672
696
|
var ObjectPrototype = Object.prototype,
|
673
|
-
stringify = JSON.stringify
|
697
|
+
stringify = JSON.stringify,
|
698
|
+
AbortSigil = {};
|
674
699
|
function defaultErrorHandler(error) {
|
675
700
|
console.error(error);
|
676
701
|
}
|
677
702
|
function defaultPostponeHandler() {}
|
678
|
-
function
|
703
|
+
function RequestInstance(
|
679
704
|
model,
|
680
705
|
bundlerConfig,
|
681
706
|
onError,
|
@@ -693,37 +718,32 @@ function createRequest(
|
|
693
718
|
var abortSet = new Set();
|
694
719
|
environmentName = [];
|
695
720
|
var hints = new Set();
|
696
|
-
|
697
|
-
|
698
|
-
|
699
|
-
|
700
|
-
|
701
|
-
|
702
|
-
|
703
|
-
|
704
|
-
|
705
|
-
|
706
|
-
|
707
|
-
|
708
|
-
|
709
|
-
|
710
|
-
|
711
|
-
|
712
|
-
|
713
|
-
|
714
|
-
|
715
|
-
|
716
|
-
|
717
|
-
|
718
|
-
|
719
|
-
|
720
|
-
|
721
|
-
onError: void 0 === onError ? defaultErrorHandler : onError,
|
722
|
-
onPostpone: void 0 === onPostpone ? defaultPostponeHandler : onPostpone
|
723
|
-
};
|
724
|
-
model = createTask(bundlerConfig, model, null, !1, abortSet);
|
721
|
+
this.status = 0;
|
722
|
+
this.flushScheduled = !1;
|
723
|
+
this.destination = this.fatalError = null;
|
724
|
+
this.bundlerConfig = bundlerConfig;
|
725
|
+
this.cache = new Map();
|
726
|
+
this.pendingChunks = this.nextChunkId = 0;
|
727
|
+
this.hints = hints;
|
728
|
+
this.abortListeners = new Set();
|
729
|
+
this.abortableTasks = abortSet;
|
730
|
+
this.pingedTasks = environmentName;
|
731
|
+
this.completedImportChunks = [];
|
732
|
+
this.completedHintChunks = [];
|
733
|
+
this.completedRegularChunks = [];
|
734
|
+
this.completedErrorChunks = [];
|
735
|
+
this.writtenSymbols = new Map();
|
736
|
+
this.writtenClientReferences = new Map();
|
737
|
+
this.writtenServerReferences = new Map();
|
738
|
+
this.writtenObjects = new WeakMap();
|
739
|
+
this.temporaryReferences = temporaryReferences;
|
740
|
+
this.identifierPrefix = identifierPrefix || "";
|
741
|
+
this.identifierCount = 1;
|
742
|
+
this.taintCleanupQueue = [];
|
743
|
+
this.onError = void 0 === onError ? defaultErrorHandler : onError;
|
744
|
+
this.onPostpone = void 0 === onPostpone ? defaultPostponeHandler : onPostpone;
|
745
|
+
model = createTask(this, model, null, !1, abortSet);
|
725
746
|
environmentName.push(model);
|
726
|
-
return bundlerConfig;
|
727
747
|
}
|
728
748
|
var currentRequest = null;
|
729
749
|
function serializeThenable(request, task, thenable) {
|
@@ -746,6 +766,14 @@ function serializeThenable(request, task, thenable) {
|
|
746
766
|
newTask.id
|
747
767
|
);
|
748
768
|
default:
|
769
|
+
if (1 === request.status)
|
770
|
+
return (
|
771
|
+
(newTask.status = 3),
|
772
|
+
(task = stringify(serializeByValueID(request.fatalError))),
|
773
|
+
emitModelChunk(request, newTask.id, task),
|
774
|
+
request.abortableTasks.delete(newTask),
|
775
|
+
newTask.id
|
776
|
+
);
|
749
777
|
"string" !== typeof thenable.status &&
|
750
778
|
((thenable.status = "pending"),
|
751
779
|
thenable.then(
|
@@ -932,7 +960,12 @@ function renderFunctionComponent(request, task, key, Component, props) {
|
|
932
960
|
thenableIndexCounter = 0;
|
933
961
|
thenableState = prevThenableState;
|
934
962
|
Component = Component(props, void 0);
|
935
|
-
if (
|
963
|
+
if (1 === request.status) throw AbortSigil;
|
964
|
+
if (
|
965
|
+
"object" === typeof Component &&
|
966
|
+
null !== Component &&
|
967
|
+
Component.$$typeof !== CLIENT_REFERENCE_TAG$1
|
968
|
+
) {
|
936
969
|
if ("function" === typeof Component.then) {
|
937
970
|
props = Component;
|
938
971
|
if ("fulfilled" === props.status) return props.value;
|
@@ -1025,6 +1058,7 @@ function renderElement(request, task, type, key, ref, props) {
|
|
1025
1058
|
case REACT_LAZY_TYPE:
|
1026
1059
|
var init = type._init;
|
1027
1060
|
type = init(type._payload);
|
1061
|
+
if (1 === request.status) throw AbortSigil;
|
1028
1062
|
return renderElement(request, task, type, key, ref, props);
|
1029
1063
|
case REACT_FORWARD_REF_TYPE:
|
1030
1064
|
return renderFunctionComponent(request, task, key, type.render, props);
|
@@ -1041,7 +1075,9 @@ function pingTask(request, task) {
|
|
1041
1075
|
pingedTasks.push(task);
|
1042
1076
|
1 === pingedTasks.length &&
|
1043
1077
|
((request.flushScheduled = null !== request.destination),
|
1044
|
-
|
1078
|
+
scheduleMicrotask(function () {
|
1079
|
+
return performWork(request);
|
1080
|
+
}));
|
1045
1081
|
}
|
1046
1082
|
function createTask(request, model, keyPath, implicitSlot, abortSet) {
|
1047
1083
|
request.pendingChunks++;
|
@@ -1073,50 +1109,61 @@ function createTask(request, model, keyPath, implicitSlot, abortSet) {
|
|
1073
1109
|
);
|
1074
1110
|
} catch (thrownValue) {
|
1075
1111
|
if (
|
1076
|
-
((parentPropertyName =
|
1112
|
+
((parentPropertyName = task.model),
|
1113
|
+
(parentPropertyName =
|
1114
|
+
"object" === typeof parentPropertyName &&
|
1115
|
+
null !== parentPropertyName &&
|
1116
|
+
(parentPropertyName.$$typeof === REACT_ELEMENT_TYPE ||
|
1117
|
+
parentPropertyName.$$typeof === REACT_LAZY_TYPE)),
|
1118
|
+
(value =
|
1077
1119
|
thrownValue === SuspenseException
|
1078
1120
|
? getSuspendedThenable()
|
1079
1121
|
: thrownValue),
|
1080
|
-
|
1081
|
-
(value =
|
1082
|
-
"object" === typeof value &&
|
1122
|
+
"object" === typeof value &&
|
1083
1123
|
null !== value &&
|
1084
|
-
|
1085
|
-
|
1086
|
-
|
1087
|
-
|
1088
|
-
|
1089
|
-
|
1090
|
-
|
1091
|
-
|
1092
|
-
|
1093
|
-
|
1094
|
-
|
1095
|
-
|
1096
|
-
|
1097
|
-
|
1098
|
-
|
1099
|
-
|
1100
|
-
|
1101
|
-
|
1102
|
-
|
1103
|
-
|
1104
|
-
|
1105
|
-
|
1106
|
-
|
1124
|
+
"function" === typeof value.then)
|
1125
|
+
)
|
1126
|
+
if (1 === request.status)
|
1127
|
+
(task.status = 3),
|
1128
|
+
(prevKeyPath = request.fatalError),
|
1129
|
+
(JSCompiler_inline_result = parentPropertyName
|
1130
|
+
? "$L" + prevKeyPath.toString(16)
|
1131
|
+
: serializeByValueID(prevKeyPath));
|
1132
|
+
else {
|
1133
|
+
JSCompiler_inline_result = createTask(
|
1134
|
+
request,
|
1135
|
+
task.model,
|
1136
|
+
task.keyPath,
|
1137
|
+
task.implicitSlot,
|
1138
|
+
request.abortableTasks
|
1139
|
+
);
|
1140
|
+
var ping = JSCompiler_inline_result.ping;
|
1141
|
+
value.then(ping, ping);
|
1142
|
+
JSCompiler_inline_result.thenableState =
|
1143
|
+
getThenableStateAfterSuspending();
|
1144
|
+
task.keyPath = prevKeyPath;
|
1145
|
+
task.implicitSlot = prevImplicitSlot;
|
1146
|
+
JSCompiler_inline_result = parentPropertyName
|
1147
|
+
? "$L" + JSCompiler_inline_result.id.toString(16)
|
1148
|
+
: serializeByValueID(JSCompiler_inline_result.id);
|
1149
|
+
}
|
1150
|
+
else if (thrownValue === AbortSigil)
|
1151
|
+
(task.status = 3),
|
1152
|
+
(prevKeyPath = request.fatalError),
|
1153
|
+
(JSCompiler_inline_result = parentPropertyName
|
1154
|
+
? "$L" + prevKeyPath.toString(16)
|
1155
|
+
: serializeByValueID(prevKeyPath));
|
1156
|
+
else if (
|
1107
1157
|
((task.keyPath = prevKeyPath),
|
1108
1158
|
(task.implicitSlot = prevImplicitSlot),
|
1109
|
-
|
1159
|
+
parentPropertyName)
|
1110
1160
|
)
|
1111
1161
|
request.pendingChunks++,
|
1112
1162
|
(prevKeyPath = request.nextChunkId++),
|
1113
|
-
(prevImplicitSlot = logRecoverableError(
|
1114
|
-
request,
|
1115
|
-
parentPropertyName
|
1116
|
-
)),
|
1163
|
+
(prevImplicitSlot = logRecoverableError(request, value)),
|
1117
1164
|
emitErrorChunk(request, prevKeyPath, prevImplicitSlot),
|
1118
1165
|
(JSCompiler_inline_result = "$L" + prevKeyPath.toString(16));
|
1119
|
-
else throw
|
1166
|
+
else throw value;
|
1120
1167
|
}
|
1121
1168
|
return JSCompiler_inline_result;
|
1122
1169
|
},
|
@@ -1269,12 +1316,11 @@ function renderModelDestructive(
|
|
1269
1316
|
parentPropertyName
|
1270
1317
|
);
|
1271
1318
|
case REACT_LAZY_TYPE:
|
1272
|
-
|
1273
|
-
|
1274
|
-
|
1275
|
-
|
1276
|
-
|
1277
|
-
);
|
1319
|
+
task.thenableState = null;
|
1320
|
+
parentPropertyName = value._init;
|
1321
|
+
value = parentPropertyName(value._payload);
|
1322
|
+
if (1 === request.status) throw AbortSigil;
|
1323
|
+
return renderModelDestructive(request, task, emptyRoot, "", value);
|
1278
1324
|
case REACT_LEGACY_ELEMENT_TYPE:
|
1279
1325
|
throw Error(
|
1280
1326
|
'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.'
|
@@ -1535,8 +1581,8 @@ function logRecoverableError(request, error) {
|
|
1535
1581
|
}
|
1536
1582
|
function fatalError(request, error) {
|
1537
1583
|
null !== request.destination
|
1538
|
-
? ((request.status =
|
1539
|
-
: ((request.status =
|
1584
|
+
? ((request.status = 3), closeWithError(request.destination, error))
|
1585
|
+
: ((request.status = 2), (request.fatalError = error));
|
1540
1586
|
}
|
1541
1587
|
function emitErrorChunk(request, id, digest) {
|
1542
1588
|
digest = { digest: digest };
|
@@ -1605,7 +1651,8 @@ function emitChunk(request, task, value) {
|
|
1605
1651
|
}
|
1606
1652
|
var emptyRoot = {};
|
1607
1653
|
function retryTask(request, task) {
|
1608
|
-
if (0 === task.status)
|
1654
|
+
if (0 === task.status) {
|
1655
|
+
task.status = 5;
|
1609
1656
|
try {
|
1610
1657
|
modelRoot = task.model;
|
1611
1658
|
var resolvedModel = renderModelDestructive(
|
@@ -1632,10 +1679,23 @@ function retryTask(request, task) {
|
|
1632
1679
|
thrownValue === SuspenseException
|
1633
1680
|
? getSuspendedThenable()
|
1634
1681
|
: thrownValue;
|
1635
|
-
if ("object" === typeof x && null !== x && "function" === typeof x.then)
|
1636
|
-
|
1637
|
-
|
1638
|
-
|
1682
|
+
if ("object" === typeof x && null !== x && "function" === typeof x.then)
|
1683
|
+
if (1 === request.status) {
|
1684
|
+
request.abortableTasks.delete(task);
|
1685
|
+
task.status = 3;
|
1686
|
+
var model = stringify(serializeByValueID(request.fatalError));
|
1687
|
+
emitModelChunk(request, task.id, model);
|
1688
|
+
} else {
|
1689
|
+
task.status = 0;
|
1690
|
+
task.thenableState = getThenableStateAfterSuspending();
|
1691
|
+
var ping = task.ping;
|
1692
|
+
x.then(ping, ping);
|
1693
|
+
}
|
1694
|
+
else if (x === AbortSigil) {
|
1695
|
+
request.abortableTasks.delete(task);
|
1696
|
+
task.status = 3;
|
1697
|
+
var model$19 = stringify(serializeByValueID(request.fatalError));
|
1698
|
+
emitModelChunk(request, task.id, model$19);
|
1639
1699
|
} else {
|
1640
1700
|
request.abortableTasks.delete(task);
|
1641
1701
|
task.status = 4;
|
@@ -1644,6 +1704,7 @@ function retryTask(request, task) {
|
|
1644
1704
|
}
|
1645
1705
|
} finally {
|
1646
1706
|
}
|
1707
|
+
}
|
1647
1708
|
}
|
1648
1709
|
function performWork(request) {
|
1649
1710
|
var prevDispatcher = ReactSharedInternalsServer.H;
|
@@ -1701,54 +1762,72 @@ function flushCompletedChunks(request, destination) {
|
|
1701
1762
|
(writtenBytes = 0));
|
1702
1763
|
}
|
1703
1764
|
0 === request.pendingChunks &&
|
1704
|
-
(destination.close(), (request.destination = null));
|
1765
|
+
((request.status = 3), destination.close(), (request.destination = null));
|
1766
|
+
}
|
1767
|
+
function startWork(request) {
|
1768
|
+
request.flushScheduled = null !== request.destination;
|
1769
|
+
scheduleWork(function () {
|
1770
|
+
return performWork(request);
|
1771
|
+
});
|
1705
1772
|
}
|
1706
1773
|
function enqueueFlush(request) {
|
1707
|
-
|
1708
|
-
!1 === request.flushScheduled &&
|
1774
|
+
!1 === request.flushScheduled &&
|
1709
1775
|
0 === request.pingedTasks.length &&
|
1710
|
-
null !== request.destination
|
1711
|
-
|
1712
|
-
|
1713
|
-
|
1714
|
-
|
1715
|
-
|
1776
|
+
null !== request.destination &&
|
1777
|
+
((request.flushScheduled = !0),
|
1778
|
+
scheduleWork(function () {
|
1779
|
+
request.flushScheduled = !1;
|
1780
|
+
var destination = request.destination;
|
1781
|
+
destination && flushCompletedChunks(request, destination);
|
1782
|
+
}));
|
1716
1783
|
}
|
1717
1784
|
function abort(request, reason) {
|
1718
1785
|
try {
|
1786
|
+
request.status = 1;
|
1719
1787
|
var abortableTasks = request.abortableTasks;
|
1720
1788
|
if (0 < abortableTasks.size) {
|
1721
1789
|
request.pendingChunks++;
|
1722
|
-
var errorId = request.nextChunkId
|
1723
|
-
|
1790
|
+
var errorId = request.nextChunkId++;
|
1791
|
+
request.fatalError = errorId;
|
1792
|
+
var error =
|
1724
1793
|
void 0 === reason
|
1725
1794
|
? Error("The render was aborted by the server without a reason.")
|
1795
|
+
: "object" === typeof reason &&
|
1796
|
+
null !== reason &&
|
1797
|
+
"function" === typeof reason.then
|
1798
|
+
? Error("The render was aborted by the server with a promise.")
|
1726
1799
|
: reason,
|
1727
1800
|
digest = logRecoverableError(request, error);
|
1728
1801
|
emitErrorChunk(request, errorId, digest, error);
|
1729
1802
|
abortableTasks.forEach(function (task) {
|
1730
|
-
task.status
|
1731
|
-
|
1732
|
-
|
1733
|
-
|
1803
|
+
if (5 !== task.status) {
|
1804
|
+
task.status = 3;
|
1805
|
+
var ref = serializeByValueID(errorId);
|
1806
|
+
task = encodeReferenceChunk(request, task.id, ref);
|
1807
|
+
request.completedErrorChunks.push(task);
|
1808
|
+
}
|
1734
1809
|
});
|
1735
1810
|
abortableTasks.clear();
|
1736
1811
|
}
|
1737
1812
|
var abortListeners = request.abortListeners;
|
1738
1813
|
if (0 < abortListeners.size) {
|
1739
|
-
var error$
|
1814
|
+
var error$26 =
|
1740
1815
|
void 0 === reason
|
1741
1816
|
? Error("The render was aborted by the server without a reason.")
|
1817
|
+
: "object" === typeof reason &&
|
1818
|
+
null !== reason &&
|
1819
|
+
"function" === typeof reason.then
|
1820
|
+
? Error("The render was aborted by the server with a promise.")
|
1742
1821
|
: reason;
|
1743
1822
|
abortListeners.forEach(function (callback) {
|
1744
|
-
return callback(error$
|
1823
|
+
return callback(error$26);
|
1745
1824
|
});
|
1746
1825
|
abortListeners.clear();
|
1747
1826
|
}
|
1748
1827
|
null !== request.destination &&
|
1749
1828
|
flushCompletedChunks(request, request.destination);
|
1750
|
-
} catch (error$
|
1751
|
-
logRecoverableError(request, error$
|
1829
|
+
} catch (error$27) {
|
1830
|
+
logRecoverableError(request, error$27), fatalError(request, error$27);
|
1752
1831
|
}
|
1753
1832
|
}
|
1754
1833
|
function resolveServerReference(bundlerConfig, id) {
|
@@ -2200,8 +2279,8 @@ function parseReadableStream(response, reference, type) {
|
|
2200
2279
|
(previousBlockedChunk = chunk));
|
2201
2280
|
} else {
|
2202
2281
|
chunk = previousBlockedChunk;
|
2203
|
-
var chunk$
|
2204
|
-
chunk$
|
2282
|
+
var chunk$30 = createPendingChunk(response);
|
2283
|
+
chunk$30.then(
|
2205
2284
|
function (v) {
|
2206
2285
|
return controller.enqueue(v);
|
2207
2286
|
},
|
@@ -2209,10 +2288,10 @@ function parseReadableStream(response, reference, type) {
|
|
2209
2288
|
return controller.error(e);
|
2210
2289
|
}
|
2211
2290
|
);
|
2212
|
-
previousBlockedChunk = chunk$
|
2291
|
+
previousBlockedChunk = chunk$30;
|
2213
2292
|
chunk.then(function () {
|
2214
|
-
previousBlockedChunk === chunk$
|
2215
|
-
resolveModelChunk(chunk$
|
2293
|
+
previousBlockedChunk === chunk$30 && (previousBlockedChunk = null);
|
2294
|
+
resolveModelChunk(chunk$30, json, -1);
|
2216
2295
|
});
|
2217
2296
|
}
|
2218
2297
|
},
|
@@ -2553,7 +2632,7 @@ exports.registerServerReference = function (reference, id, exportName) {
|
|
2553
2632
|
});
|
2554
2633
|
};
|
2555
2634
|
exports.renderToReadableStream = function (model, webpackMap, options) {
|
2556
|
-
var request =
|
2635
|
+
var request = new RequestInstance(
|
2557
2636
|
model,
|
2558
2637
|
webpackMap,
|
2559
2638
|
options ? options.onError : void 0,
|
@@ -2577,13 +2656,12 @@ exports.renderToReadableStream = function (model, webpackMap, options) {
|
|
2577
2656
|
{
|
2578
2657
|
type: "bytes",
|
2579
2658
|
start: function () {
|
2580
|
-
request
|
2581
|
-
performWork(request);
|
2659
|
+
startWork(request);
|
2582
2660
|
},
|
2583
2661
|
pull: function (controller) {
|
2584
|
-
if (
|
2585
|
-
(request.status =
|
2586
|
-
else if (
|
2662
|
+
if (2 === request.status)
|
2663
|
+
(request.status = 3), closeWithError(controller, request.fatalError);
|
2664
|
+
else if (3 !== request.status && null === request.destination) {
|
2587
2665
|
request.destination = controller;
|
2588
2666
|
try {
|
2589
2667
|
flushCompletedChunks(request, controller);
|