react-server-dom-webpack 19.0.0 → 19.1.0-canary-7130d0c6-20241212
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 +6 -4
- package/cjs/react-server-dom-webpack-client.browser.production.js +2 -1
- package/cjs/react-server-dom-webpack-client.edge.development.js +4 -2
- package/cjs/react-server-dom-webpack-client.edge.production.js +2 -1
- package/cjs/react-server-dom-webpack-client.node.development.js +4 -2
- package/cjs/react-server-dom-webpack-client.node.production.js +2 -1
- package/cjs/react-server-dom-webpack-client.node.unbundled.development.js +4 -2
- package/cjs/react-server-dom-webpack-client.node.unbundled.production.js +2 -1
- package/cjs/react-server-dom-webpack-server.browser.development.js +212 -200
- package/cjs/react-server-dom-webpack-server.browser.production.js +161 -142
- package/cjs/react-server-dom-webpack-server.edge.development.js +212 -200
- package/cjs/react-server-dom-webpack-server.edge.production.js +161 -142
- package/cjs/react-server-dom-webpack-server.node.development.js +209 -188
- package/cjs/react-server-dom-webpack-server.node.production.js +155 -134
- package/cjs/react-server-dom-webpack-server.node.unbundled.development.js +209 -188
- package/cjs/react-server-dom-webpack-server.node.unbundled.production.js +155 -134
- package/package.json +3 -3
- package/static.browser.js +2 -2
- package/static.edge.js +2 -2
- package/static.node.js +2 -2
- package/static.node.unbundled.js +2 -2
@@ -442,7 +442,7 @@ function getIteratorFn(maybeIterable) {
|
|
442
442
|
}
|
443
443
|
var ASYNC_ITERATOR = Symbol.asyncIterator,
|
444
444
|
SuspenseException = Error(
|
445
|
-
"Suspense Exception: This is not a real error! It's an implementation detail of `use` to interrupt the current render. You must either rethrow it immediately, or move the `use` call outside of the `try/catch` block. Capturing without rethrowing will lead to unexpected behavior.\n\nTo handle async errors, wrap your component in an error boundary, or call the promise's `.catch` method and pass the result to `use
|
445
|
+
"Suspense Exception: This is not a real error! It's an implementation detail of `use` to interrupt the current render. You must either rethrow it immediately, or move the `use` call outside of the `try/catch` block. Capturing without rethrowing will lead to unexpected behavior.\n\nTo handle async errors, wrap your component in an error boundary, or call the promise's `.catch` method and pass the result to `use`."
|
446
446
|
);
|
447
447
|
function noop$1() {}
|
448
448
|
function trackUsedThenable(thenableState, thenable, index) {
|
@@ -782,13 +782,7 @@ function serializeThenable(request, task, thenable) {
|
|
782
782
|
(newTask.model = thenable.value), pingTask(request, newTask), newTask.id
|
783
783
|
);
|
784
784
|
case "rejected":
|
785
|
-
return (
|
786
|
-
(task = logRecoverableError(request, thenable.reason, null)),
|
787
|
-
emitErrorChunk(request, newTask.id, task),
|
788
|
-
(newTask.status = 4),
|
789
|
-
request.abortableTasks.delete(newTask),
|
790
|
-
newTask.id
|
791
|
-
);
|
785
|
+
return erroredTask(request, newTask, thenable.reason), newTask.id;
|
792
786
|
default:
|
793
787
|
if (12 === request.status)
|
794
788
|
return (
|
@@ -819,11 +813,7 @@ function serializeThenable(request, task, thenable) {
|
|
819
813
|
},
|
820
814
|
function (reason) {
|
821
815
|
0 === newTask.status &&
|
822
|
-
((
|
823
|
-
emitErrorChunk(request, newTask.id, reason),
|
824
|
-
(newTask.status = 4),
|
825
|
-
request.abortableTasks.delete(newTask),
|
826
|
-
enqueueFlush(request));
|
816
|
+
(erroredTask(request, newTask, reason), enqueueFlush(request));
|
827
817
|
}
|
828
818
|
);
|
829
819
|
return newTask.id;
|
@@ -844,29 +834,25 @@ function serializeReadableStream(request, task, stream) {
|
|
844
834
|
emitChunk(request, streamTask, streamTask.model),
|
845
835
|
enqueueFlush(request),
|
846
836
|
reader.read().then(progress, error);
|
847
|
-
} catch (x$
|
848
|
-
error(x$
|
837
|
+
} catch (x$7) {
|
838
|
+
error(x$7);
|
849
839
|
}
|
850
840
|
}
|
851
841
|
function error(reason) {
|
852
|
-
|
853
|
-
aborted = !0
|
854
|
-
request.abortListeners.delete(abortStream)
|
855
|
-
|
856
|
-
|
857
|
-
|
858
|
-
reader.cancel(reason).then(error, error);
|
859
|
-
}
|
842
|
+
aborted ||
|
843
|
+
((aborted = !0),
|
844
|
+
request.abortListeners.delete(abortStream),
|
845
|
+
erroredTask(request, streamTask, reason),
|
846
|
+
enqueueFlush(request),
|
847
|
+
reader.cancel(reason).then(error, error));
|
860
848
|
}
|
861
849
|
function abortStream(reason) {
|
862
|
-
|
863
|
-
aborted = !0
|
864
|
-
request.abortListeners.delete(abortStream)
|
865
|
-
|
866
|
-
|
867
|
-
|
868
|
-
reader.cancel(reason).then(error, error);
|
869
|
-
}
|
850
|
+
aborted ||
|
851
|
+
((aborted = !0),
|
852
|
+
request.abortListeners.delete(abortStream),
|
853
|
+
erroredTask(request, streamTask, reason),
|
854
|
+
enqueueFlush(request),
|
855
|
+
reader.cancel(reason).then(error, error));
|
870
856
|
}
|
871
857
|
var supportsBYOB = stream.supportsBYOB;
|
872
858
|
if (void 0 === supportsBYOB)
|
@@ -921,31 +907,27 @@ function serializeAsyncIterable(request, task, iterable, iterator) {
|
|
921
907
|
emitChunk(request, streamTask, streamTask.model),
|
922
908
|
enqueueFlush(request),
|
923
909
|
iterator.next().then(progress, error);
|
924
|
-
} catch (x$
|
925
|
-
error(x$
|
910
|
+
} catch (x$8) {
|
911
|
+
error(x$8);
|
926
912
|
}
|
927
913
|
}
|
928
914
|
function error(reason) {
|
929
|
-
|
930
|
-
aborted = !0
|
931
|
-
request.abortListeners.delete(abortIterable)
|
932
|
-
|
933
|
-
|
934
|
-
enqueueFlush(request);
|
915
|
+
aborted ||
|
916
|
+
((aborted = !0),
|
917
|
+
request.abortListeners.delete(abortIterable),
|
918
|
+
erroredTask(request, streamTask, reason),
|
919
|
+
enqueueFlush(request),
|
935
920
|
"function" === typeof iterator.throw &&
|
936
|
-
iterator.throw(reason).then(error, error);
|
937
|
-
}
|
921
|
+
iterator.throw(reason).then(error, error));
|
938
922
|
}
|
939
923
|
function abortIterable(reason) {
|
940
|
-
|
941
|
-
aborted = !0
|
942
|
-
request.abortListeners.delete(abortIterable)
|
943
|
-
|
944
|
-
|
945
|
-
enqueueFlush(request);
|
924
|
+
aborted ||
|
925
|
+
((aborted = !0),
|
926
|
+
request.abortListeners.delete(abortIterable),
|
927
|
+
erroredTask(request, streamTask, reason),
|
928
|
+
enqueueFlush(request),
|
946
929
|
"function" === typeof iterator.throw &&
|
947
|
-
iterator.throw(reason).then(error, error);
|
948
|
-
}
|
930
|
+
iterator.throw(reason).then(error, error));
|
949
931
|
}
|
950
932
|
iterable = iterable === iterator;
|
951
933
|
var streamTask = createTask(
|
@@ -966,11 +948,8 @@ function serializeAsyncIterable(request, task, iterable, iterator) {
|
|
966
948
|
}
|
967
949
|
function emitHint(request, code, model) {
|
968
950
|
model = stringify(model);
|
969
|
-
|
970
|
-
code
|
971
|
-
code = id.toString(16) + ":" + code;
|
972
|
-
model = stringToChunk(code + model + "\n");
|
973
|
-
request.completedHintChunks.push(model);
|
951
|
+
code = stringToChunk(":H" + code + model + "\n");
|
952
|
+
request.completedHintChunks.push(code);
|
974
953
|
enqueueFlush(request);
|
975
954
|
}
|
976
955
|
function readThenable(thenable) {
|
@@ -1001,63 +980,57 @@ function createLazyWrapperAroundWakeable(wakeable) {
|
|
1001
980
|
return { $$typeof: REACT_LAZY_TYPE, _payload: wakeable, _init: readThenable };
|
1002
981
|
}
|
1003
982
|
function voidHandler() {}
|
983
|
+
function processServerComponentReturnValue(request, task, Component, result) {
|
984
|
+
if (
|
985
|
+
"object" !== typeof result ||
|
986
|
+
null === result ||
|
987
|
+
result.$$typeof === CLIENT_REFERENCE_TAG$1
|
988
|
+
)
|
989
|
+
return result;
|
990
|
+
if ("function" === typeof result.then)
|
991
|
+
return "fulfilled" === result.status
|
992
|
+
? result.value
|
993
|
+
: createLazyWrapperAroundWakeable(result);
|
994
|
+
var iteratorFn = getIteratorFn(result);
|
995
|
+
return iteratorFn
|
996
|
+
? ((request = {}),
|
997
|
+
(request[Symbol.iterator] = function () {
|
998
|
+
return iteratorFn.call(result);
|
999
|
+
}),
|
1000
|
+
request)
|
1001
|
+
: "function" !== typeof result[ASYNC_ITERATOR] ||
|
1002
|
+
("function" === typeof ReadableStream &&
|
1003
|
+
result instanceof ReadableStream)
|
1004
|
+
? result
|
1005
|
+
: ((request = {}),
|
1006
|
+
(request[ASYNC_ITERATOR] = function () {
|
1007
|
+
return result[ASYNC_ITERATOR]();
|
1008
|
+
}),
|
1009
|
+
request);
|
1010
|
+
}
|
1004
1011
|
function renderFunctionComponent(request, task, key, Component, props) {
|
1005
1012
|
var prevThenableState = task.thenableState;
|
1006
1013
|
task.thenableState = null;
|
1007
1014
|
thenableIndexCounter = 0;
|
1008
1015
|
thenableState = prevThenableState;
|
1009
|
-
|
1016
|
+
props = Component(props, void 0);
|
1010
1017
|
if (12 === request.status)
|
1011
1018
|
throw (
|
1012
|
-
("object" === typeof
|
1013
|
-
null !==
|
1014
|
-
"function" === typeof
|
1015
|
-
|
1016
|
-
|
1019
|
+
("object" === typeof props &&
|
1020
|
+
null !== props &&
|
1021
|
+
"function" === typeof props.then &&
|
1022
|
+
props.$$typeof !== CLIENT_REFERENCE_TAG$1 &&
|
1023
|
+
props.then(voidHandler, voidHandler),
|
1017
1024
|
null)
|
1018
1025
|
);
|
1019
|
-
|
1020
|
-
|
1021
|
-
null !== Component &&
|
1022
|
-
Component.$$typeof !== CLIENT_REFERENCE_TAG$1
|
1023
|
-
) {
|
1024
|
-
if ("function" === typeof Component.then) {
|
1025
|
-
props = Component;
|
1026
|
-
if ("fulfilled" === props.status) return props.value;
|
1027
|
-
Component = createLazyWrapperAroundWakeable(Component);
|
1028
|
-
}
|
1029
|
-
var iteratorFn = getIteratorFn(Component);
|
1030
|
-
if (iteratorFn) {
|
1031
|
-
var iterableChild = Component;
|
1032
|
-
Component = {};
|
1033
|
-
Component =
|
1034
|
-
((Component[Symbol.iterator] = function () {
|
1035
|
-
return iteratorFn.call(iterableChild);
|
1036
|
-
}),
|
1037
|
-
Component);
|
1038
|
-
} else if (
|
1039
|
-
!(
|
1040
|
-
"function" !== typeof Component[ASYNC_ITERATOR] ||
|
1041
|
-
("function" === typeof ReadableStream &&
|
1042
|
-
Component instanceof ReadableStream)
|
1043
|
-
)
|
1044
|
-
) {
|
1045
|
-
var iterableChild$10 = Component;
|
1046
|
-
Component = {};
|
1047
|
-
Component =
|
1048
|
-
((Component[ASYNC_ITERATOR] = function () {
|
1049
|
-
return iterableChild$10[ASYNC_ITERATOR]();
|
1050
|
-
}),
|
1051
|
-
Component);
|
1052
|
-
}
|
1053
|
-
}
|
1054
|
-
props = task.keyPath;
|
1026
|
+
props = processServerComponentReturnValue(request, task, Component, props);
|
1027
|
+
Component = task.keyPath;
|
1055
1028
|
prevThenableState = task.implicitSlot;
|
1056
1029
|
null !== key
|
1057
|
-
? (task.keyPath = null ===
|
1058
|
-
: null ===
|
1059
|
-
request = renderModelDestructive(request, task, emptyRoot, "",
|
1060
|
-
task.keyPath =
|
1030
|
+
? (task.keyPath = null === Component ? key : Component + "," + key)
|
1031
|
+
: null === Component && (task.implicitSlot = !0);
|
1032
|
+
request = renderModelDestructive(request, task, emptyRoot, "", props);
|
1033
|
+
task.keyPath = Component;
|
1061
1034
|
task.implicitSlot = prevThenableState;
|
1062
1035
|
return request;
|
1063
1036
|
}
|
@@ -1316,24 +1289,20 @@ function serializeBlob(request, blob) {
|
|
1316
1289
|
);
|
1317
1290
|
}
|
1318
1291
|
function error(reason) {
|
1319
|
-
|
1320
|
-
aborted = !0
|
1321
|
-
request.abortListeners.delete(abortBlob)
|
1322
|
-
|
1323
|
-
|
1324
|
-
|
1325
|
-
reader.cancel(reason).then(error, error);
|
1326
|
-
}
|
1292
|
+
aborted ||
|
1293
|
+
((aborted = !0),
|
1294
|
+
request.abortListeners.delete(abortBlob),
|
1295
|
+
erroredTask(request, newTask, reason),
|
1296
|
+
enqueueFlush(request),
|
1297
|
+
reader.cancel(reason).then(error, error));
|
1327
1298
|
}
|
1328
1299
|
function abortBlob(reason) {
|
1329
|
-
|
1330
|
-
aborted = !0
|
1331
|
-
request.abortListeners.delete(abortBlob)
|
1332
|
-
|
1333
|
-
|
1334
|
-
|
1335
|
-
reader.cancel(reason).then(error, error);
|
1336
|
-
}
|
1300
|
+
aborted ||
|
1301
|
+
((aborted = !0),
|
1302
|
+
request.abortListeners.delete(abortBlob),
|
1303
|
+
erroredTask(request, newTask, reason),
|
1304
|
+
enqueueFlush(request),
|
1305
|
+
reader.cancel(reason).then(error, error));
|
1337
1306
|
}
|
1338
1307
|
var model = [blob.type],
|
1339
1308
|
newTask = createTask(request, model, null, !1, request.abortableTasks),
|
@@ -1737,6 +1706,12 @@ function emitChunk(request, task, value) {
|
|
1737
1706
|
: ((value = stringify(value, task.toJSON)),
|
1738
1707
|
emitModelChunk(request, task.id, value));
|
1739
1708
|
}
|
1709
|
+
function erroredTask(request, task, error) {
|
1710
|
+
request.abortableTasks.delete(task);
|
1711
|
+
task.status = 4;
|
1712
|
+
error = logRecoverableError(request, error, task);
|
1713
|
+
emitErrorChunk(request, task.id, error);
|
1714
|
+
}
|
1740
1715
|
var emptyRoot = {};
|
1741
1716
|
function retryTask(request, task) {
|
1742
1717
|
if (0 === task.status) {
|
@@ -1782,12 +1757,7 @@ function retryTask(request, task) {
|
|
1782
1757
|
task.thenableState = getThenableStateAfterSuspending();
|
1783
1758
|
var ping = task.ping;
|
1784
1759
|
x.then(ping, ping);
|
1785
|
-
} else
|
1786
|
-
request.abortableTasks.delete(task);
|
1787
|
-
task.status = 4;
|
1788
|
-
var digest = logRecoverableError(request, x, task);
|
1789
|
-
emitErrorChunk(request, task.id, digest);
|
1790
|
-
}
|
1760
|
+
} else erroredTask(request, task, x);
|
1791
1761
|
}
|
1792
1762
|
} finally {
|
1793
1763
|
}
|
@@ -1880,6 +1850,18 @@ function enqueueFlush(request) {
|
|
1880
1850
|
destination && flushCompletedChunks(request, destination);
|
1881
1851
|
}, 0));
|
1882
1852
|
}
|
1853
|
+
function startFlowing(request, destination) {
|
1854
|
+
if (13 === request.status)
|
1855
|
+
(request.status = 14), closeWithError(destination, request.fatalError);
|
1856
|
+
else if (14 !== request.status && null === request.destination) {
|
1857
|
+
request.destination = destination;
|
1858
|
+
try {
|
1859
|
+
flushCompletedChunks(request, destination);
|
1860
|
+
} catch (error) {
|
1861
|
+
logRecoverableError(request, error, null), fatalError(request, error);
|
1862
|
+
}
|
1863
|
+
}
|
1864
|
+
}
|
1883
1865
|
function abort(request, reason) {
|
1884
1866
|
try {
|
1885
1867
|
11 >= request.status && (request.status = 12);
|
@@ -1912,7 +1894,7 @@ function abort(request, reason) {
|
|
1912
1894
|
}
|
1913
1895
|
var abortListeners = request.abortListeners;
|
1914
1896
|
if (0 < abortListeners.size) {
|
1915
|
-
var error$
|
1897
|
+
var error$22 =
|
1916
1898
|
void 0 === reason
|
1917
1899
|
? Error("The render was aborted by the server without a reason.")
|
1918
1900
|
: "object" === typeof reason &&
|
@@ -1921,14 +1903,14 @@ function abort(request, reason) {
|
|
1921
1903
|
? Error("The render was aborted by the server with a promise.")
|
1922
1904
|
: reason;
|
1923
1905
|
abortListeners.forEach(function (callback) {
|
1924
|
-
return callback(error$
|
1906
|
+
return callback(error$22);
|
1925
1907
|
});
|
1926
1908
|
abortListeners.clear();
|
1927
1909
|
}
|
1928
1910
|
null !== request.destination &&
|
1929
1911
|
flushCompletedChunks(request, request.destination);
|
1930
|
-
} catch (error$
|
1931
|
-
logRecoverableError(request, error$
|
1912
|
+
} catch (error$23) {
|
1913
|
+
logRecoverableError(request, error$23, null), fatalError(request, error$23);
|
1932
1914
|
}
|
1933
1915
|
}
|
1934
1916
|
function resolveServerReference(bundlerConfig, id) {
|
@@ -2373,8 +2355,8 @@ function parseReadableStream(response, reference, type) {
|
|
2373
2355
|
(previousBlockedChunk = chunk));
|
2374
2356
|
} else {
|
2375
2357
|
chunk = previousBlockedChunk;
|
2376
|
-
var chunk$
|
2377
|
-
chunk$
|
2358
|
+
var chunk$26 = createPendingChunk(response);
|
2359
|
+
chunk$26.then(
|
2378
2360
|
function (v) {
|
2379
2361
|
return controller.enqueue(v);
|
2380
2362
|
},
|
@@ -2382,10 +2364,10 @@ function parseReadableStream(response, reference, type) {
|
|
2382
2364
|
return controller.error(e);
|
2383
2365
|
}
|
2384
2366
|
);
|
2385
|
-
previousBlockedChunk = chunk$
|
2367
|
+
previousBlockedChunk = chunk$26;
|
2386
2368
|
chunk.then(function () {
|
2387
|
-
previousBlockedChunk === chunk$
|
2388
|
-
resolveModelChunk(chunk$
|
2369
|
+
previousBlockedChunk === chunk$26 && (previousBlockedChunk = null);
|
2370
|
+
resolveModelChunk(chunk$26, json, -1);
|
2389
2371
|
});
|
2390
2372
|
}
|
2391
2373
|
},
|
@@ -2757,17 +2739,7 @@ exports.renderToReadableStream = function (model, webpackMap, options) {
|
|
2757
2739
|
startWork(request);
|
2758
2740
|
},
|
2759
2741
|
pull: function (controller) {
|
2760
|
-
|
2761
|
-
(request.status = 14), closeWithError(controller, request.fatalError);
|
2762
|
-
else if (14 !== request.status && null === request.destination) {
|
2763
|
-
request.destination = controller;
|
2764
|
-
try {
|
2765
|
-
flushCompletedChunks(request, controller);
|
2766
|
-
} catch (error) {
|
2767
|
-
logRecoverableError(request, error, null),
|
2768
|
-
fatalError(request, error);
|
2769
|
-
}
|
2770
|
-
}
|
2742
|
+
startFlowing(request, controller);
|
2771
2743
|
},
|
2772
2744
|
cancel: function (reason) {
|
2773
2745
|
request.destination = null;
|
@@ -2777,3 +2749,50 @@ exports.renderToReadableStream = function (model, webpackMap, options) {
|
|
2777
2749
|
{ highWaterMark: 0 }
|
2778
2750
|
);
|
2779
2751
|
};
|
2752
|
+
exports.unstable_prerender = function (model, webpackMap, options) {
|
2753
|
+
return new Promise(function (resolve, reject) {
|
2754
|
+
var request = new RequestInstance(
|
2755
|
+
21,
|
2756
|
+
model,
|
2757
|
+
webpackMap,
|
2758
|
+
options ? options.onError : void 0,
|
2759
|
+
options ? options.identifierPrefix : void 0,
|
2760
|
+
options ? options.onPostpone : void 0,
|
2761
|
+
options ? options.temporaryReferences : void 0,
|
2762
|
+
void 0,
|
2763
|
+
void 0,
|
2764
|
+
function () {
|
2765
|
+
var stream = new ReadableStream(
|
2766
|
+
{
|
2767
|
+
type: "bytes",
|
2768
|
+
start: function () {
|
2769
|
+
startWork(request);
|
2770
|
+
},
|
2771
|
+
pull: function (controller) {
|
2772
|
+
startFlowing(request, controller);
|
2773
|
+
},
|
2774
|
+
cancel: function (reason) {
|
2775
|
+
request.destination = null;
|
2776
|
+
abort(request, reason);
|
2777
|
+
}
|
2778
|
+
},
|
2779
|
+
{ highWaterMark: 0 }
|
2780
|
+
);
|
2781
|
+
resolve({ prelude: stream });
|
2782
|
+
},
|
2783
|
+
reject
|
2784
|
+
);
|
2785
|
+
if (options && options.signal) {
|
2786
|
+
var signal = options.signal;
|
2787
|
+
if (signal.aborted) abort(request, signal.reason);
|
2788
|
+
else {
|
2789
|
+
var listener = function () {
|
2790
|
+
abort(request, signal.reason);
|
2791
|
+
signal.removeEventListener("abort", listener);
|
2792
|
+
};
|
2793
|
+
signal.addEventListener("abort", listener);
|
2794
|
+
}
|
2795
|
+
}
|
2796
|
+
startWork(request);
|
2797
|
+
});
|
2798
|
+
};
|