react-server-dom-webpack 19.0.0-canary-fd0da3eef-20240404 → 19.0.0-canary-4c12339ce-20240408
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 +32 -8
- package/cjs/react-server-dom-webpack-client.browser.production.js +22 -1
- package/cjs/react-server-dom-webpack-client.browser.production.min.js +4 -3
- package/cjs/react-server-dom-webpack-client.browser.production.min.js.map +1 -1
- package/cjs/react-server-dom-webpack-client.edge.development.js +32 -8
- package/cjs/react-server-dom-webpack-client.edge.production.js +22 -1
- package/cjs/react-server-dom-webpack-client.edge.production.min.js +3 -3
- package/cjs/react-server-dom-webpack-client.edge.production.min.js.map +1 -1
- package/cjs/react-server-dom-webpack-client.node.development.js +32 -8
- package/cjs/react-server-dom-webpack-client.node.production.js +22 -1
- package/cjs/react-server-dom-webpack-client.node.production.min.js +8 -8
- package/cjs/react-server-dom-webpack-client.node.production.min.js.map +1 -1
- package/cjs/react-server-dom-webpack-client.node.unbundled.development.js +32 -8
- package/cjs/react-server-dom-webpack-client.node.unbundled.production.js +22 -1
- package/cjs/react-server-dom-webpack-client.node.unbundled.production.min.js +31 -31
- package/cjs/react-server-dom-webpack-client.node.unbundled.production.min.js.map +1 -1
- package/cjs/react-server-dom-webpack-server.browser.development.js +278 -21
- package/cjs/react-server-dom-webpack-server.browser.production.js +24 -5
- package/cjs/react-server-dom-webpack-server.browser.production.min.js +45 -45
- package/cjs/react-server-dom-webpack-server.browser.production.min.js.map +1 -1
- package/cjs/react-server-dom-webpack-server.edge.development.js +278 -21
- package/cjs/react-server-dom-webpack-server.edge.production.js +24 -5
- package/cjs/react-server-dom-webpack-server.edge.production.min.js +45 -45
- package/cjs/react-server-dom-webpack-server.edge.production.min.js.map +1 -1
- package/cjs/react-server-dom-webpack-server.node.development.js +278 -21
- package/cjs/react-server-dom-webpack-server.node.production.js +24 -5
- package/cjs/react-server-dom-webpack-server.node.production.min.js +2 -2
- package/cjs/react-server-dom-webpack-server.node.production.min.js.map +1 -1
- package/cjs/react-server-dom-webpack-server.node.unbundled.development.js +278 -21
- package/cjs/react-server-dom-webpack-server.node.unbundled.production.js +24 -5
- package/cjs/react-server-dom-webpack-server.node.unbundled.production.min.js +2 -2
- package/cjs/react-server-dom-webpack-server.node.unbundled.production.min.js.map +1 -1
- package/package.json +3 -3
- package/umd/react-server-dom-webpack-client.browser.development.js +32 -8
- package/umd/react-server-dom-webpack-client.browser.production.min.js +16 -16
- package/umd/react-server-dom-webpack-server.browser.development.js +278 -21
- package/umd/react-server-dom-webpack-server.browser.production.min.js +45 -45
@@ -458,6 +458,7 @@ var ReactDOMSharedInternals = ReactDOM.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL
|
|
458
458
|
var ReactDOMCurrentDispatcher = ReactDOMSharedInternals.ReactDOMCurrentDispatcher;
|
459
459
|
var previousDispatcher = ReactDOMCurrentDispatcher.current;
|
460
460
|
ReactDOMCurrentDispatcher.current = {
|
461
|
+
flushSyncWork: previousDispatcher.flushSyncWork,
|
461
462
|
prefetchDNS: prefetchDNS,
|
462
463
|
preconnect: preconnect,
|
463
464
|
preload: preload,
|
@@ -933,21 +934,34 @@ function getSuspendedThenable() {
|
|
933
934
|
var currentRequest$1 = null;
|
934
935
|
var thenableIndexCounter = 0;
|
935
936
|
var thenableState = null;
|
937
|
+
var currentComponentDebugInfo = null;
|
936
938
|
function prepareToUseHooksForRequest(request) {
|
937
939
|
currentRequest$1 = request;
|
938
940
|
}
|
939
941
|
function resetHooksForRequest() {
|
940
942
|
currentRequest$1 = null;
|
941
943
|
}
|
942
|
-
function prepareToUseHooksForComponent(prevThenableState) {
|
944
|
+
function prepareToUseHooksForComponent(prevThenableState, componentDebugInfo) {
|
943
945
|
thenableIndexCounter = 0;
|
944
946
|
thenableState = prevThenableState;
|
947
|
+
|
948
|
+
{
|
949
|
+
currentComponentDebugInfo = componentDebugInfo;
|
950
|
+
}
|
945
951
|
}
|
946
952
|
function getThenableStateAfterSuspending() {
|
947
953
|
// If you use() to Suspend this should always exist but if you throw a Promise instead,
|
948
954
|
// which is not really supported anymore, it will be empty. We use the empty set as a
|
949
955
|
// marker to know if this was a replay of the same component or first attempt.
|
950
956
|
var state = thenableState || createThenableState();
|
957
|
+
|
958
|
+
{
|
959
|
+
// This is a hack but we stash the debug info here so that we don't need a completely
|
960
|
+
// different data structure just for this in DEV. Not too happy about it.
|
961
|
+
state._componentDebugInfo = currentComponentDebugInfo;
|
962
|
+
currentComponentDebugInfo = null;
|
963
|
+
}
|
964
|
+
|
951
965
|
thenableState = null;
|
952
966
|
return state;
|
953
967
|
}
|
@@ -1426,6 +1440,7 @@ var SEEN_BUT_NOT_YET_OUTLINED = -1;
|
|
1426
1440
|
var NEVER_OUTLINED = -2;
|
1427
1441
|
var ReactCurrentCache = ReactSharedServerInternals.ReactCurrentCache;
|
1428
1442
|
var ReactCurrentDispatcher = ReactSharedInternals.ReactCurrentDispatcher;
|
1443
|
+
var ReactCurrentOwner = ReactSharedInternals.ReactCurrentOwner;
|
1429
1444
|
|
1430
1445
|
function defaultErrorHandler(error) {
|
1431
1446
|
console['error'](error); // Don't transform to our wrapper
|
@@ -1651,33 +1666,56 @@ function createLazyWrapperAroundWakeable(wakeable) {
|
|
1651
1666
|
return lazyType;
|
1652
1667
|
}
|
1653
1668
|
|
1654
|
-
function renderFunctionComponent(request, task, key, Component, props) {
|
1669
|
+
function renderFunctionComponent(request, task, key, Component, props, owner) {
|
1655
1670
|
// Reset the task's thenable state before continuing, so that if a later
|
1656
1671
|
// component suspends we can reuse the same task object. If the same
|
1657
1672
|
// component suspends again, the thenable state will be restored.
|
1658
1673
|
var prevThenableState = task.thenableState;
|
1659
1674
|
task.thenableState = null;
|
1675
|
+
var componentDebugInfo = null;
|
1660
1676
|
|
1661
1677
|
{
|
1662
1678
|
if (debugID === null) {
|
1663
1679
|
// We don't have a chunk to assign debug info. We need to outline this
|
1664
1680
|
// component to assign it an ID.
|
1665
1681
|
return outlineTask(request, task);
|
1666
|
-
} else if (prevThenableState !== null)
|
1682
|
+
} else if (prevThenableState !== null) {
|
1683
|
+
// This is a replay and we've already emitted the debug info of this component
|
1684
|
+
// in the first pass. We skip emitting a duplicate line.
|
1685
|
+
// As a hack we stashed the previous component debug info on this object in DEV.
|
1686
|
+
componentDebugInfo = prevThenableState._componentDebugInfo;
|
1687
|
+
} else {
|
1667
1688
|
// This is a new component in the same task so we can emit more debug info.
|
1668
1689
|
var componentName = Component.displayName || Component.name || '';
|
1669
1690
|
request.pendingChunks++;
|
1670
|
-
|
1691
|
+
var componentDebugID = debugID;
|
1692
|
+
componentDebugInfo = {
|
1671
1693
|
name: componentName,
|
1672
|
-
env: request.environmentName
|
1673
|
-
|
1694
|
+
env: request.environmentName,
|
1695
|
+
owner: owner
|
1696
|
+
}; // We outline this model eagerly so that we can refer to by reference as an owner.
|
1697
|
+
// If we had a smarter way to dedupe we might not have to do this if there ends up
|
1698
|
+
// being no references to this as an owner.
|
1699
|
+
|
1700
|
+
outlineModel(request, componentDebugInfo);
|
1701
|
+
emitDebugChunk(request, componentDebugID, componentDebugInfo);
|
1674
1702
|
}
|
1675
1703
|
}
|
1676
1704
|
|
1677
|
-
prepareToUseHooksForComponent(prevThenableState); // The secondArg is always undefined in Server Components since refs error early.
|
1705
|
+
prepareToUseHooksForComponent(prevThenableState, componentDebugInfo); // The secondArg is always undefined in Server Components since refs error early.
|
1678
1706
|
|
1679
1707
|
var secondArg = undefined;
|
1680
|
-
var result
|
1708
|
+
var result;
|
1709
|
+
|
1710
|
+
{
|
1711
|
+
ReactCurrentOwner.current = componentDebugInfo;
|
1712
|
+
|
1713
|
+
try {
|
1714
|
+
result = Component(props, secondArg);
|
1715
|
+
} finally {
|
1716
|
+
ReactCurrentOwner.current = null;
|
1717
|
+
}
|
1718
|
+
}
|
1681
1719
|
|
1682
1720
|
if (typeof result === 'object' && result !== null && typeof result.then === 'function') {
|
1683
1721
|
// When the return value is in children position we can resolve it immediately,
|
@@ -1768,7 +1806,8 @@ function renderFragment(request, task, children) {
|
|
1768
1806
|
return children;
|
1769
1807
|
}
|
1770
1808
|
|
1771
|
-
function renderClientElement(task, type, key, props)
|
1809
|
+
function renderClientElement(task, type, key, props, owner) // DEV-only
|
1810
|
+
{
|
1772
1811
|
// the keys of any Server Components which are not serialized.
|
1773
1812
|
|
1774
1813
|
|
@@ -1780,7 +1819,7 @@ function renderClientElement(task, type, key, props) {
|
|
1780
1819
|
key = keyPath + ',' + key;
|
1781
1820
|
}
|
1782
1821
|
|
1783
|
-
var element = [REACT_ELEMENT_TYPE, type, key, props];
|
1822
|
+
var element = [REACT_ELEMENT_TYPE, type, key, props, owner] ;
|
1784
1823
|
|
1785
1824
|
if (task.implicitSlot && key !== null) {
|
1786
1825
|
// The root Server Component had no key so it was in an implicit slot.
|
@@ -1818,7 +1857,8 @@ function outlineTask(request, task) {
|
|
1818
1857
|
return serializeLazyID(newTask.id);
|
1819
1858
|
}
|
1820
1859
|
|
1821
|
-
function renderElement(request, task, type, key, ref, props)
|
1860
|
+
function renderElement(request, task, type, key, ref, props, owner) // DEV only
|
1861
|
+
{
|
1822
1862
|
if (ref !== null && ref !== undefined) {
|
1823
1863
|
// When the ref moves to the regular props object this will implicitly
|
1824
1864
|
// throw for functions. We could probably relax it to a DEV warning for other
|
@@ -1839,14 +1879,14 @@ function renderElement(request, task, type, key, ref, props) {
|
|
1839
1879
|
if (typeof type === 'function') {
|
1840
1880
|
if (isClientReference(type) || isTemporaryReference(type)) {
|
1841
1881
|
// This is a reference to a Client Component.
|
1842
|
-
return renderClientElement(task, type, key, props);
|
1882
|
+
return renderClientElement(task, type, key, props, owner);
|
1843
1883
|
} // This is a Server Component.
|
1844
1884
|
|
1845
1885
|
|
1846
|
-
return renderFunctionComponent(request, task, key, type, props);
|
1886
|
+
return renderFunctionComponent(request, task, key, type, props, owner);
|
1847
1887
|
} else if (typeof type === 'string') {
|
1848
1888
|
// This is a host element. E.g. HTML.
|
1849
|
-
return renderClientElement(task, type, key, props);
|
1889
|
+
return renderClientElement(task, type, key, props, owner);
|
1850
1890
|
} else if (typeof type === 'symbol') {
|
1851
1891
|
if (type === REACT_FRAGMENT_TYPE && key === null) {
|
1852
1892
|
// For key-less fragments, we add a small optimization to avoid serializing
|
@@ -1864,11 +1904,11 @@ function renderElement(request, task, type, key, ref, props) {
|
|
1864
1904
|
// Any built-in works as long as its props are serializable.
|
1865
1905
|
|
1866
1906
|
|
1867
|
-
return renderClientElement(task, type, key, props);
|
1907
|
+
return renderClientElement(task, type, key, props, owner);
|
1868
1908
|
} else if (type != null && typeof type === 'object') {
|
1869
1909
|
if (isClientReference(type)) {
|
1870
1910
|
// This is a reference to a Client Component.
|
1871
|
-
return renderClientElement(task, type, key, props);
|
1911
|
+
return renderClientElement(task, type, key, props, owner);
|
1872
1912
|
}
|
1873
1913
|
|
1874
1914
|
switch (type.$$typeof) {
|
@@ -1877,17 +1917,17 @@ function renderElement(request, task, type, key, ref, props) {
|
|
1877
1917
|
var payload = type._payload;
|
1878
1918
|
var init = type._init;
|
1879
1919
|
var wrappedType = init(payload);
|
1880
|
-
return renderElement(request, task, wrappedType, key, ref, props);
|
1920
|
+
return renderElement(request, task, wrappedType, key, ref, props, owner);
|
1881
1921
|
}
|
1882
1922
|
|
1883
1923
|
case REACT_FORWARD_REF_TYPE:
|
1884
1924
|
{
|
1885
|
-
return renderFunctionComponent(request, task, key, type.render, props);
|
1925
|
+
return renderFunctionComponent(request, task, key, type.render, props, owner);
|
1886
1926
|
}
|
1887
1927
|
|
1888
1928
|
case REACT_MEMO_TYPE:
|
1889
1929
|
{
|
1890
|
-
return renderElement(request, task, type.type, key, ref, props);
|
1930
|
+
return renderElement(request, task, type.type, key, ref, props, owner);
|
1891
1931
|
}
|
1892
1932
|
}
|
1893
1933
|
}
|
@@ -1966,6 +2006,10 @@ function serializeLazyID(id) {
|
|
1966
2006
|
return '$L' + id.toString(16);
|
1967
2007
|
}
|
1968
2008
|
|
2009
|
+
function serializeInfinitePromise() {
|
2010
|
+
return '$@';
|
2011
|
+
}
|
2012
|
+
|
1969
2013
|
function serializePromiseID(id) {
|
1970
2014
|
return '$@' + id.toString(16);
|
1971
2015
|
}
|
@@ -2130,6 +2174,12 @@ function serializeMap(request, map) {
|
|
2130
2174
|
return '$Q' + id.toString(16);
|
2131
2175
|
}
|
2132
2176
|
|
2177
|
+
function serializeFormData(request, formData) {
|
2178
|
+
var entries = Array.from(formData.entries());
|
2179
|
+
var id = outlineModel(request, entries);
|
2180
|
+
return '$K' + id.toString(16);
|
2181
|
+
}
|
2182
|
+
|
2133
2183
|
function serializeSet(request, set) {
|
2134
2184
|
var entries = Array.from(set);
|
2135
2185
|
|
@@ -2306,7 +2356,7 @@ function renderModelDestructive(request, task, parent, parentPropertyName, value
|
|
2306
2356
|
|
2307
2357
|
|
2308
2358
|
return renderElement(request, task, element.type, // $FlowFixMe[incompatible-call] the key of an element is null | string
|
2309
|
-
element.key, ref, props);
|
2359
|
+
element.key, ref, props, element._owner );
|
2310
2360
|
}
|
2311
2361
|
|
2312
2362
|
case REACT_LAZY_TYPE:
|
@@ -2404,6 +2454,11 @@ function renderModelDestructive(request, task, parent, parentPropertyName, value
|
|
2404
2454
|
|
2405
2455
|
if (value instanceof Set) {
|
2406
2456
|
return serializeSet(request, value);
|
2457
|
+
} // TODO: FormData is not available in old Node. Remove the typeof later.
|
2458
|
+
|
2459
|
+
|
2460
|
+
if (typeof FormData === 'function' && value instanceof FormData) {
|
2461
|
+
return serializeFormData(request, value);
|
2407
2462
|
}
|
2408
2463
|
|
2409
2464
|
var iteratorFn = getIteratorFn(value);
|
@@ -2671,14 +2726,216 @@ function emitModelChunk(request, id, json) {
|
|
2671
2726
|
}
|
2672
2727
|
|
2673
2728
|
function emitDebugChunk(request, id, debugInfo) {
|
2729
|
+
// use the full serialization that requires a task.
|
2730
|
+
|
2731
|
+
|
2732
|
+
var counter = {
|
2733
|
+
objectCount: 0
|
2734
|
+
};
|
2674
2735
|
|
2736
|
+
function replacer(parentPropertyName, value) {
|
2737
|
+
return renderConsoleValue(request, counter, this, parentPropertyName, value);
|
2738
|
+
} // $FlowFixMe[incompatible-type] stringify can return null
|
2675
2739
|
|
2676
|
-
|
2740
|
+
|
2741
|
+
var json = stringify(debugInfo, replacer);
|
2677
2742
|
var row = serializeRowHeader('D', id) + json + '\n';
|
2678
2743
|
var processedChunk = stringToChunk(row);
|
2679
2744
|
request.completedRegularChunks.push(processedChunk);
|
2680
2745
|
}
|
2681
2746
|
|
2747
|
+
function serializeEval(source) {
|
2748
|
+
|
2749
|
+
return '$E' + source;
|
2750
|
+
} // This is a forked version of renderModel which should never error, never suspend and is limited
|
2751
|
+
// in the depth it can encode.
|
2752
|
+
|
2753
|
+
|
2754
|
+
function renderConsoleValue(request, counter, parent, parentPropertyName, value) {
|
2755
|
+
// Make sure that `parent[parentPropertyName]` wasn't JSONified before `value` was passed to us
|
2756
|
+
// $FlowFixMe[incompatible-use]
|
2757
|
+
var originalValue = parent[parentPropertyName];
|
2758
|
+
|
2759
|
+
if (value === null) {
|
2760
|
+
return null;
|
2761
|
+
}
|
2762
|
+
|
2763
|
+
if (typeof value === 'object') {
|
2764
|
+
if (isClientReference(value)) {
|
2765
|
+
// We actually have this value on the client so we could import it.
|
2766
|
+
// This might be confusing though because on the Server it won't actually
|
2767
|
+
// be this value, so if you're debugging client references maybe you'd be
|
2768
|
+
// better with a place holder.
|
2769
|
+
return serializeClientReference(request, parent, parentPropertyName, value);
|
2770
|
+
}
|
2771
|
+
|
2772
|
+
if (counter.objectCount > 20) {
|
2773
|
+
// We've reached our max number of objects to serialize across the wire so we serialize this
|
2774
|
+
// object but no properties inside of it, as a place holder.
|
2775
|
+
return Array.isArray(value) ? [] : {};
|
2776
|
+
}
|
2777
|
+
|
2778
|
+
counter.objectCount++;
|
2779
|
+
var writtenObjects = request.writtenObjects;
|
2780
|
+
var existingId = writtenObjects.get(value); // $FlowFixMe[method-unbinding]
|
2781
|
+
|
2782
|
+
if (typeof value.then === 'function') {
|
2783
|
+
if (existingId !== undefined) {
|
2784
|
+
// We've seen this promise before, so we can just refer to the same result.
|
2785
|
+
return serializePromiseID(existingId);
|
2786
|
+
}
|
2787
|
+
|
2788
|
+
var thenable = value;
|
2789
|
+
|
2790
|
+
switch (thenable.status) {
|
2791
|
+
case 'fulfilled':
|
2792
|
+
{
|
2793
|
+
return serializePromiseID(outlineConsoleValue(request, counter, thenable.value));
|
2794
|
+
}
|
2795
|
+
|
2796
|
+
case 'rejected':
|
2797
|
+
{
|
2798
|
+
var x = thenable.reason;
|
2799
|
+
request.pendingChunks++;
|
2800
|
+
var errorId = request.nextChunkId++;
|
2801
|
+
|
2802
|
+
{
|
2803
|
+
// We don't log these errors since they didn't actually throw into Flight.
|
2804
|
+
var digest = '';
|
2805
|
+
emitErrorChunk(request, errorId, digest, x);
|
2806
|
+
}
|
2807
|
+
|
2808
|
+
return serializePromiseID(errorId);
|
2809
|
+
}
|
2810
|
+
} // If it hasn't already resolved (and been instrumented) we just encode an infinite
|
2811
|
+
// promise that will never resolve.
|
2812
|
+
|
2813
|
+
|
2814
|
+
return serializeInfinitePromise();
|
2815
|
+
}
|
2816
|
+
|
2817
|
+
if (existingId !== undefined && existingId >= 0) {
|
2818
|
+
// We've already emitted this as a real object, so we can
|
2819
|
+
// just refer to that by its existing ID.
|
2820
|
+
return serializeByValueID(existingId);
|
2821
|
+
}
|
2822
|
+
|
2823
|
+
if (isArray(value)) {
|
2824
|
+
return value;
|
2825
|
+
}
|
2826
|
+
|
2827
|
+
if (value instanceof Map) {
|
2828
|
+
return serializeMap(request, value);
|
2829
|
+
}
|
2830
|
+
|
2831
|
+
if (value instanceof Set) {
|
2832
|
+
return serializeSet(request, value);
|
2833
|
+
} // TODO: FormData is not available in old Node. Remove the typeof later.
|
2834
|
+
|
2835
|
+
|
2836
|
+
if (typeof FormData === 'function' && value instanceof FormData) {
|
2837
|
+
return serializeFormData(request, value);
|
2838
|
+
}
|
2839
|
+
|
2840
|
+
var iteratorFn = getIteratorFn(value);
|
2841
|
+
|
2842
|
+
if (iteratorFn) {
|
2843
|
+
return Array.from(value);
|
2844
|
+
} // $FlowFixMe[incompatible-return]
|
2845
|
+
|
2846
|
+
|
2847
|
+
return value;
|
2848
|
+
}
|
2849
|
+
|
2850
|
+
if (typeof value === 'string') {
|
2851
|
+
if (value[value.length - 1] === 'Z') {
|
2852
|
+
// Possibly a Date, whose toJSON automatically calls toISOString
|
2853
|
+
if (originalValue instanceof Date) {
|
2854
|
+
return serializeDateFromDateJSON(value);
|
2855
|
+
}
|
2856
|
+
}
|
2857
|
+
|
2858
|
+
if (value.length >= 1024) {
|
2859
|
+
// For large strings, we encode them outside the JSON payload so that we
|
2860
|
+
// don't have to double encode and double parse the strings. This can also
|
2861
|
+
// be more compact in case the string has a lot of escaped characters.
|
2862
|
+
return serializeLargeTextString(request, value);
|
2863
|
+
}
|
2864
|
+
|
2865
|
+
return escapeStringValue(value);
|
2866
|
+
}
|
2867
|
+
|
2868
|
+
if (typeof value === 'boolean') {
|
2869
|
+
return value;
|
2870
|
+
}
|
2871
|
+
|
2872
|
+
if (typeof value === 'number') {
|
2873
|
+
return serializeNumber(value);
|
2874
|
+
}
|
2875
|
+
|
2876
|
+
if (typeof value === 'undefined') {
|
2877
|
+
return serializeUndefined();
|
2878
|
+
}
|
2879
|
+
|
2880
|
+
if (typeof value === 'function') {
|
2881
|
+
if (isClientReference(value)) {
|
2882
|
+
return serializeClientReference(request, parent, parentPropertyName, value);
|
2883
|
+
}
|
2884
|
+
|
2885
|
+
if (isTemporaryReference(value)) {
|
2886
|
+
return serializeTemporaryReference(request, value);
|
2887
|
+
} // Serialize the body of the function as an eval so it can be printed.
|
2888
|
+
// $FlowFixMe[method-unbinding]
|
2889
|
+
|
2890
|
+
|
2891
|
+
return serializeEval('(' + Function.prototype.toString.call(value) + ')');
|
2892
|
+
}
|
2893
|
+
|
2894
|
+
if (typeof value === 'symbol') {
|
2895
|
+
var writtenSymbols = request.writtenSymbols;
|
2896
|
+
|
2897
|
+
var _existingId3 = writtenSymbols.get(value);
|
2898
|
+
|
2899
|
+
if (_existingId3 !== undefined) {
|
2900
|
+
return serializeByValueID(_existingId3);
|
2901
|
+
} // $FlowFixMe[incompatible-type] `description` might be undefined
|
2902
|
+
|
2903
|
+
|
2904
|
+
var name = value.description; // We use the Symbol.for version if it's not a global symbol. Close enough.
|
2905
|
+
|
2906
|
+
request.pendingChunks++;
|
2907
|
+
var symbolId = request.nextChunkId++;
|
2908
|
+
emitSymbolChunk(request, symbolId, name);
|
2909
|
+
return serializeByValueID(symbolId);
|
2910
|
+
}
|
2911
|
+
|
2912
|
+
if (typeof value === 'bigint') {
|
2913
|
+
return serializeBigInt(value);
|
2914
|
+
}
|
2915
|
+
|
2916
|
+
return 'unknown type ' + typeof value;
|
2917
|
+
}
|
2918
|
+
|
2919
|
+
function outlineConsoleValue(request, counter, model) {
|
2920
|
+
|
2921
|
+
function replacer(parentPropertyName, value) {
|
2922
|
+
try {
|
2923
|
+
return renderConsoleValue(request, counter, this, parentPropertyName, value);
|
2924
|
+
} catch (x) {
|
2925
|
+
return 'unknown value';
|
2926
|
+
}
|
2927
|
+
} // $FlowFixMe[incompatible-type] stringify can return null
|
2928
|
+
|
2929
|
+
|
2930
|
+
var json = stringify(model, replacer);
|
2931
|
+
request.pendingChunks++;
|
2932
|
+
var id = request.nextChunkId++;
|
2933
|
+
var row = id.toString(16) + ':' + json + '\n';
|
2934
|
+
var processedChunk = stringToChunk(row);
|
2935
|
+
request.completedRegularChunks.push(processedChunk);
|
2936
|
+
return id;
|
2937
|
+
}
|
2938
|
+
|
2682
2939
|
function forwardDebugInfo(request, id, debugInfo) {
|
2683
2940
|
for (var i = 0; i < debugInfo.length; i++) {
|
2684
2941
|
request.pendingChunks++;
|
@@ -410,6 +410,7 @@ const ReactDOMSharedInternals = ReactDOM.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WI
|
|
410
410
|
const ReactDOMCurrentDispatcher = ReactDOMSharedInternals.ReactDOMCurrentDispatcher;
|
411
411
|
const previousDispatcher = ReactDOMCurrentDispatcher.current;
|
412
412
|
ReactDOMCurrentDispatcher.current = {
|
413
|
+
flushSyncWork: previousDispatcher.flushSyncWork,
|
413
414
|
prefetchDNS,
|
414
415
|
preconnect,
|
415
416
|
preload,
|
@@ -893,7 +894,7 @@ function prepareToUseHooksForRequest(request) {
|
|
893
894
|
function resetHooksForRequest() {
|
894
895
|
currentRequest$1 = null;
|
895
896
|
}
|
896
|
-
function prepareToUseHooksForComponent(prevThenableState) {
|
897
|
+
function prepareToUseHooksForComponent(prevThenableState, componentDebugInfo) {
|
897
898
|
thenableIndexCounter = 0;
|
898
899
|
thenableState = prevThenableState;
|
899
900
|
}
|
@@ -902,6 +903,7 @@ function getThenableStateAfterSuspending() {
|
|
902
903
|
// which is not really supported anymore, it will be empty. We use the empty set as a
|
903
904
|
// marker to know if this was a replay of the same component or first attempt.
|
904
905
|
const state = thenableState || createThenableState();
|
906
|
+
|
905
907
|
thenableState = null;
|
906
908
|
return state;
|
907
909
|
}
|
@@ -1461,7 +1463,7 @@ function createLazyWrapperAroundWakeable(wakeable) {
|
|
1461
1463
|
return lazyType;
|
1462
1464
|
}
|
1463
1465
|
|
1464
|
-
function renderFunctionComponent(request, task, key, Component, props) {
|
1466
|
+
function renderFunctionComponent(request, task, key, Component, props, owner) {
|
1465
1467
|
// Reset the task's thenable state before continuing, so that if a later
|
1466
1468
|
// component suspends we can reuse the same task object. If the same
|
1467
1469
|
// component suspends again, the thenable state will be restored.
|
@@ -1471,7 +1473,11 @@ function renderFunctionComponent(request, task, key, Component, props) {
|
|
1471
1473
|
prepareToUseHooksForComponent(prevThenableState); // The secondArg is always undefined in Server Components since refs error early.
|
1472
1474
|
|
1473
1475
|
const secondArg = undefined;
|
1474
|
-
let result
|
1476
|
+
let result;
|
1477
|
+
|
1478
|
+
{
|
1479
|
+
result = Component(props, secondArg);
|
1480
|
+
}
|
1475
1481
|
|
1476
1482
|
if (typeof result === 'object' && result !== null && typeof result.then === 'function') {
|
1477
1483
|
// When the return value is in children position we can resolve it immediately,
|
@@ -1545,7 +1551,8 @@ function renderFragment(request, task, children) {
|
|
1545
1551
|
return children;
|
1546
1552
|
}
|
1547
1553
|
|
1548
|
-
function renderClientElement(task, type, key, props)
|
1554
|
+
function renderClientElement(task, type, key, props, owner) // DEV-only
|
1555
|
+
{
|
1549
1556
|
// the keys of any Server Components which are not serialized.
|
1550
1557
|
|
1551
1558
|
|
@@ -1578,7 +1585,8 @@ function renderClientElement(task, type, key, props) {
|
|
1578
1585
|
|
1579
1586
|
let debugID = null;
|
1580
1587
|
|
1581
|
-
function renderElement(request, task, type, key, ref, props)
|
1588
|
+
function renderElement(request, task, type, key, ref, props, owner) // DEV only
|
1589
|
+
{
|
1582
1590
|
if (ref !== null && ref !== undefined) {
|
1583
1591
|
// When the ref moves to the regular props object this will implicitly
|
1584
1592
|
// throw for functions. We could probably relax it to a DEV warning for other
|
@@ -1859,6 +1867,12 @@ function serializeMap(request, map) {
|
|
1859
1867
|
return '$Q' + id.toString(16);
|
1860
1868
|
}
|
1861
1869
|
|
1870
|
+
function serializeFormData(request, formData) {
|
1871
|
+
const entries = Array.from(formData.entries());
|
1872
|
+
const id = outlineModel(request, entries);
|
1873
|
+
return '$K' + id.toString(16);
|
1874
|
+
}
|
1875
|
+
|
1862
1876
|
function serializeSet(request, set) {
|
1863
1877
|
const entries = Array.from(set);
|
1864
1878
|
|
@@ -2095,6 +2109,11 @@ function renderModelDestructive(request, task, parent, parentPropertyName, value
|
|
2095
2109
|
|
2096
2110
|
if (value instanceof Set) {
|
2097
2111
|
return serializeSet(request, value);
|
2112
|
+
} // TODO: FormData is not available in old Node. Remove the typeof later.
|
2113
|
+
|
2114
|
+
|
2115
|
+
if (typeof FormData === 'function' && value instanceof FormData) {
|
2116
|
+
return serializeFormData(request, value);
|
2098
2117
|
}
|
2099
2118
|
|
2100
2119
|
const iteratorFn = getIteratorFn(value);
|