react-server-dom-webpack 19.0.0-rc-6230622a1a-20240610 → 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 -3272
- package/cjs/react-server-dom-webpack-client.browser.production.js +30 -22
- package/cjs/react-server-dom-webpack-client.edge.development.js +1984 -3549
- package/cjs/react-server-dom-webpack-client.edge.production.js +30 -25
- package/cjs/react-server-dom-webpack-client.node.development.js +1944 -3510
- package/cjs/react-server-dom-webpack-client.node.production.js +14 -20
- package/cjs/react-server-dom-webpack-client.node.unbundled.development.js +1898 -3442
- package/cjs/react-server-dom-webpack-client.node.unbundled.production.js +14 -20
- package/cjs/react-server-dom-webpack-server.browser.development.js +3264 -5256
- package/cjs/react-server-dom-webpack-server.browser.production.js +183 -109
- package/cjs/react-server-dom-webpack-server.edge.development.js +3272 -5267
- package/cjs/react-server-dom-webpack-server.edge.production.js +165 -110
- package/cjs/react-server-dom-webpack-server.node.development.js +3350 -5416
- package/cjs/react-server-dom-webpack-server.node.production.js +160 -116
- package/cjs/react-server-dom-webpack-server.node.unbundled.development.js +3315 -5343
- package/cjs/react-server-dom-webpack-server.node.unbundled.production.js +160 -116
- 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,6 +960,7 @@ function renderFunctionComponent(request, task, key, Component, props) {
|
|
932
960
|
thenableIndexCounter = 0;
|
933
961
|
thenableState = prevThenableState;
|
934
962
|
Component = Component(props, void 0);
|
963
|
+
if (1 === request.status) throw AbortSigil;
|
935
964
|
if (
|
936
965
|
"object" === typeof Component &&
|
937
966
|
null !== Component &&
|
@@ -1029,6 +1058,7 @@ function renderElement(request, task, type, key, ref, props) {
|
|
1029
1058
|
case REACT_LAZY_TYPE:
|
1030
1059
|
var init = type._init;
|
1031
1060
|
type = init(type._payload);
|
1061
|
+
if (1 === request.status) throw AbortSigil;
|
1032
1062
|
return renderElement(request, task, type, key, ref, props);
|
1033
1063
|
case REACT_FORWARD_REF_TYPE:
|
1034
1064
|
return renderFunctionComponent(request, task, key, type.render, props);
|
@@ -1045,7 +1075,9 @@ function pingTask(request, task) {
|
|
1045
1075
|
pingedTasks.push(task);
|
1046
1076
|
1 === pingedTasks.length &&
|
1047
1077
|
((request.flushScheduled = null !== request.destination),
|
1048
|
-
|
1078
|
+
scheduleMicrotask(function () {
|
1079
|
+
return performWork(request);
|
1080
|
+
}));
|
1049
1081
|
}
|
1050
1082
|
function createTask(request, model, keyPath, implicitSlot, abortSet) {
|
1051
1083
|
request.pendingChunks++;
|
@@ -1077,50 +1109,61 @@ function createTask(request, model, keyPath, implicitSlot, abortSet) {
|
|
1077
1109
|
);
|
1078
1110
|
} catch (thrownValue) {
|
1079
1111
|
if (
|
1080
|
-
((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 =
|
1081
1119
|
thrownValue === SuspenseException
|
1082
1120
|
? getSuspendedThenable()
|
1083
1121
|
: thrownValue),
|
1084
|
-
|
1085
|
-
(value =
|
1086
|
-
"object" === typeof value &&
|
1122
|
+
"object" === typeof value &&
|
1087
1123
|
null !== value &&
|
1088
|
-
|
1089
|
-
|
1090
|
-
|
1091
|
-
|
1092
|
-
|
1093
|
-
|
1094
|
-
|
1095
|
-
|
1096
|
-
|
1097
|
-
|
1098
|
-
|
1099
|
-
|
1100
|
-
|
1101
|
-
|
1102
|
-
|
1103
|
-
|
1104
|
-
|
1105
|
-
|
1106
|
-
|
1107
|
-
|
1108
|
-
|
1109
|
-
|
1110
|
-
|
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 (
|
1111
1157
|
((task.keyPath = prevKeyPath),
|
1112
1158
|
(task.implicitSlot = prevImplicitSlot),
|
1113
|
-
|
1159
|
+
parentPropertyName)
|
1114
1160
|
)
|
1115
1161
|
request.pendingChunks++,
|
1116
1162
|
(prevKeyPath = request.nextChunkId++),
|
1117
|
-
(prevImplicitSlot = logRecoverableError(
|
1118
|
-
request,
|
1119
|
-
parentPropertyName
|
1120
|
-
)),
|
1163
|
+
(prevImplicitSlot = logRecoverableError(request, value)),
|
1121
1164
|
emitErrorChunk(request, prevKeyPath, prevImplicitSlot),
|
1122
1165
|
(JSCompiler_inline_result = "$L" + prevKeyPath.toString(16));
|
1123
|
-
else throw
|
1166
|
+
else throw value;
|
1124
1167
|
}
|
1125
1168
|
return JSCompiler_inline_result;
|
1126
1169
|
},
|
@@ -1273,12 +1316,11 @@ function renderModelDestructive(
|
|
1273
1316
|
parentPropertyName
|
1274
1317
|
);
|
1275
1318
|
case REACT_LAZY_TYPE:
|
1276
|
-
|
1277
|
-
|
1278
|
-
|
1279
|
-
|
1280
|
-
|
1281
|
-
);
|
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);
|
1282
1324
|
case REACT_LEGACY_ELEMENT_TYPE:
|
1283
1325
|
throw Error(
|
1284
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.'
|
@@ -1539,8 +1581,8 @@ function logRecoverableError(request, error) {
|
|
1539
1581
|
}
|
1540
1582
|
function fatalError(request, error) {
|
1541
1583
|
null !== request.destination
|
1542
|
-
? ((request.status =
|
1543
|
-
: ((request.status =
|
1584
|
+
? ((request.status = 3), closeWithError(request.destination, error))
|
1585
|
+
: ((request.status = 2), (request.fatalError = error));
|
1544
1586
|
}
|
1545
1587
|
function emitErrorChunk(request, id, digest) {
|
1546
1588
|
digest = { digest: digest };
|
@@ -1609,7 +1651,8 @@ function emitChunk(request, task, value) {
|
|
1609
1651
|
}
|
1610
1652
|
var emptyRoot = {};
|
1611
1653
|
function retryTask(request, task) {
|
1612
|
-
if (0 === task.status)
|
1654
|
+
if (0 === task.status) {
|
1655
|
+
task.status = 5;
|
1613
1656
|
try {
|
1614
1657
|
modelRoot = task.model;
|
1615
1658
|
var resolvedModel = renderModelDestructive(
|
@@ -1636,10 +1679,23 @@ function retryTask(request, task) {
|
|
1636
1679
|
thrownValue === SuspenseException
|
1637
1680
|
? getSuspendedThenable()
|
1638
1681
|
: thrownValue;
|
1639
|
-
if ("object" === typeof x && null !== x && "function" === typeof x.then)
|
1640
|
-
|
1641
|
-
|
1642
|
-
|
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);
|
1643
1699
|
} else {
|
1644
1700
|
request.abortableTasks.delete(task);
|
1645
1701
|
task.status = 4;
|
@@ -1648,6 +1704,7 @@ function retryTask(request, task) {
|
|
1648
1704
|
}
|
1649
1705
|
} finally {
|
1650
1706
|
}
|
1707
|
+
}
|
1651
1708
|
}
|
1652
1709
|
function performWork(request) {
|
1653
1710
|
var prevDispatcher = ReactSharedInternalsServer.H;
|
@@ -1705,54 +1762,72 @@ function flushCompletedChunks(request, destination) {
|
|
1705
1762
|
(writtenBytes = 0));
|
1706
1763
|
}
|
1707
1764
|
0 === request.pendingChunks &&
|
1708
|
-
(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
|
+
});
|
1709
1772
|
}
|
1710
1773
|
function enqueueFlush(request) {
|
1711
|
-
|
1712
|
-
!1 === request.flushScheduled &&
|
1774
|
+
!1 === request.flushScheduled &&
|
1713
1775
|
0 === request.pingedTasks.length &&
|
1714
|
-
null !== request.destination
|
1715
|
-
|
1716
|
-
|
1717
|
-
|
1718
|
-
|
1719
|
-
|
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
|
+
}));
|
1720
1783
|
}
|
1721
1784
|
function abort(request, reason) {
|
1722
1785
|
try {
|
1786
|
+
request.status = 1;
|
1723
1787
|
var abortableTasks = request.abortableTasks;
|
1724
1788
|
if (0 < abortableTasks.size) {
|
1725
1789
|
request.pendingChunks++;
|
1726
|
-
var errorId = request.nextChunkId
|
1727
|
-
|
1790
|
+
var errorId = request.nextChunkId++;
|
1791
|
+
request.fatalError = errorId;
|
1792
|
+
var error =
|
1728
1793
|
void 0 === reason
|
1729
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.")
|
1730
1799
|
: reason,
|
1731
1800
|
digest = logRecoverableError(request, error);
|
1732
1801
|
emitErrorChunk(request, errorId, digest, error);
|
1733
1802
|
abortableTasks.forEach(function (task) {
|
1734
|
-
task.status
|
1735
|
-
|
1736
|
-
|
1737
|
-
|
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
|
+
}
|
1738
1809
|
});
|
1739
1810
|
abortableTasks.clear();
|
1740
1811
|
}
|
1741
1812
|
var abortListeners = request.abortListeners;
|
1742
1813
|
if (0 < abortListeners.size) {
|
1743
|
-
var error$
|
1814
|
+
var error$26 =
|
1744
1815
|
void 0 === reason
|
1745
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.")
|
1746
1821
|
: reason;
|
1747
1822
|
abortListeners.forEach(function (callback) {
|
1748
|
-
return callback(error$
|
1823
|
+
return callback(error$26);
|
1749
1824
|
});
|
1750
1825
|
abortListeners.clear();
|
1751
1826
|
}
|
1752
1827
|
null !== request.destination &&
|
1753
1828
|
flushCompletedChunks(request, request.destination);
|
1754
|
-
} catch (error$
|
1755
|
-
logRecoverableError(request, error$
|
1829
|
+
} catch (error$27) {
|
1830
|
+
logRecoverableError(request, error$27), fatalError(request, error$27);
|
1756
1831
|
}
|
1757
1832
|
}
|
1758
1833
|
function resolveServerReference(bundlerConfig, id) {
|
@@ -2204,8 +2279,8 @@ function parseReadableStream(response, reference, type) {
|
|
2204
2279
|
(previousBlockedChunk = chunk));
|
2205
2280
|
} else {
|
2206
2281
|
chunk = previousBlockedChunk;
|
2207
|
-
var chunk$
|
2208
|
-
chunk$
|
2282
|
+
var chunk$30 = createPendingChunk(response);
|
2283
|
+
chunk$30.then(
|
2209
2284
|
function (v) {
|
2210
2285
|
return controller.enqueue(v);
|
2211
2286
|
},
|
@@ -2213,10 +2288,10 @@ function parseReadableStream(response, reference, type) {
|
|
2213
2288
|
return controller.error(e);
|
2214
2289
|
}
|
2215
2290
|
);
|
2216
|
-
previousBlockedChunk = chunk$
|
2291
|
+
previousBlockedChunk = chunk$30;
|
2217
2292
|
chunk.then(function () {
|
2218
|
-
previousBlockedChunk === chunk$
|
2219
|
-
resolveModelChunk(chunk$
|
2293
|
+
previousBlockedChunk === chunk$30 && (previousBlockedChunk = null);
|
2294
|
+
resolveModelChunk(chunk$30, json, -1);
|
2220
2295
|
});
|
2221
2296
|
}
|
2222
2297
|
},
|
@@ -2557,7 +2632,7 @@ exports.registerServerReference = function (reference, id, exportName) {
|
|
2557
2632
|
});
|
2558
2633
|
};
|
2559
2634
|
exports.renderToReadableStream = function (model, webpackMap, options) {
|
2560
|
-
var request =
|
2635
|
+
var request = new RequestInstance(
|
2561
2636
|
model,
|
2562
2637
|
webpackMap,
|
2563
2638
|
options ? options.onError : void 0,
|
@@ -2581,13 +2656,12 @@ exports.renderToReadableStream = function (model, webpackMap, options) {
|
|
2581
2656
|
{
|
2582
2657
|
type: "bytes",
|
2583
2658
|
start: function () {
|
2584
|
-
request
|
2585
|
-
performWork(request);
|
2659
|
+
startWork(request);
|
2586
2660
|
},
|
2587
2661
|
pull: function (controller) {
|
2588
|
-
if (
|
2589
|
-
(request.status =
|
2590
|
-
else if (
|
2662
|
+
if (2 === request.status)
|
2663
|
+
(request.status = 3), closeWithError(controller, request.fatalError);
|
2664
|
+
else if (3 !== request.status && null === request.destination) {
|
2591
2665
|
request.destination = controller;
|
2592
2666
|
try {
|
2593
2667
|
flushCompletedChunks(request, controller);
|