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
@@ -525,6 +525,7 @@ var ReactDOMSharedInternals = ReactDOM.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL
|
|
525
525
|
var ReactDOMCurrentDispatcher = ReactDOMSharedInternals.ReactDOMCurrentDispatcher;
|
526
526
|
var previousDispatcher = ReactDOMCurrentDispatcher.current;
|
527
527
|
ReactDOMCurrentDispatcher.current = {
|
528
|
+
flushSyncWork: previousDispatcher.flushSyncWork,
|
528
529
|
prefetchDNS: prefetchDNS,
|
529
530
|
preconnect: preconnect,
|
530
531
|
preload: preload,
|
@@ -992,21 +993,34 @@ function getSuspendedThenable() {
|
|
992
993
|
var currentRequest$1 = null;
|
993
994
|
var thenableIndexCounter = 0;
|
994
995
|
var thenableState = null;
|
996
|
+
var currentComponentDebugInfo = null;
|
995
997
|
function prepareToUseHooksForRequest(request) {
|
996
998
|
currentRequest$1 = request;
|
997
999
|
}
|
998
1000
|
function resetHooksForRequest() {
|
999
1001
|
currentRequest$1 = null;
|
1000
1002
|
}
|
1001
|
-
function prepareToUseHooksForComponent(prevThenableState) {
|
1003
|
+
function prepareToUseHooksForComponent(prevThenableState, componentDebugInfo) {
|
1002
1004
|
thenableIndexCounter = 0;
|
1003
1005
|
thenableState = prevThenableState;
|
1006
|
+
|
1007
|
+
{
|
1008
|
+
currentComponentDebugInfo = componentDebugInfo;
|
1009
|
+
}
|
1004
1010
|
}
|
1005
1011
|
function getThenableStateAfterSuspending() {
|
1006
1012
|
// If you use() to Suspend this should always exist but if you throw a Promise instead,
|
1007
1013
|
// which is not really supported anymore, it will be empty. We use the empty set as a
|
1008
1014
|
// marker to know if this was a replay of the same component or first attempt.
|
1009
1015
|
var state = thenableState || createThenableState();
|
1016
|
+
|
1017
|
+
{
|
1018
|
+
// This is a hack but we stash the debug info here so that we don't need a completely
|
1019
|
+
// different data structure just for this in DEV. Not too happy about it.
|
1020
|
+
state._componentDebugInfo = currentComponentDebugInfo;
|
1021
|
+
currentComponentDebugInfo = null;
|
1022
|
+
}
|
1023
|
+
|
1010
1024
|
thenableState = null;
|
1011
1025
|
return state;
|
1012
1026
|
}
|
@@ -1485,6 +1499,7 @@ var SEEN_BUT_NOT_YET_OUTLINED = -1;
|
|
1485
1499
|
var NEVER_OUTLINED = -2;
|
1486
1500
|
var ReactCurrentCache = ReactSharedServerInternals.ReactCurrentCache;
|
1487
1501
|
var ReactCurrentDispatcher = ReactSharedInternals.ReactCurrentDispatcher;
|
1502
|
+
var ReactCurrentOwner = ReactSharedInternals.ReactCurrentOwner;
|
1488
1503
|
|
1489
1504
|
function defaultErrorHandler(error) {
|
1490
1505
|
console['error'](error); // Don't transform to our wrapper
|
@@ -1710,33 +1725,56 @@ function createLazyWrapperAroundWakeable(wakeable) {
|
|
1710
1725
|
return lazyType;
|
1711
1726
|
}
|
1712
1727
|
|
1713
|
-
function renderFunctionComponent(request, task, key, Component, props) {
|
1728
|
+
function renderFunctionComponent(request, task, key, Component, props, owner) {
|
1714
1729
|
// Reset the task's thenable state before continuing, so that if a later
|
1715
1730
|
// component suspends we can reuse the same task object. If the same
|
1716
1731
|
// component suspends again, the thenable state will be restored.
|
1717
1732
|
var prevThenableState = task.thenableState;
|
1718
1733
|
task.thenableState = null;
|
1734
|
+
var componentDebugInfo = null;
|
1719
1735
|
|
1720
1736
|
{
|
1721
1737
|
if (debugID === null) {
|
1722
1738
|
// We don't have a chunk to assign debug info. We need to outline this
|
1723
1739
|
// component to assign it an ID.
|
1724
1740
|
return outlineTask(request, task);
|
1725
|
-
} else if (prevThenableState !== null)
|
1741
|
+
} else if (prevThenableState !== null) {
|
1742
|
+
// This is a replay and we've already emitted the debug info of this component
|
1743
|
+
// in the first pass. We skip emitting a duplicate line.
|
1744
|
+
// As a hack we stashed the previous component debug info on this object in DEV.
|
1745
|
+
componentDebugInfo = prevThenableState._componentDebugInfo;
|
1746
|
+
} else {
|
1726
1747
|
// This is a new component in the same task so we can emit more debug info.
|
1727
1748
|
var componentName = Component.displayName || Component.name || '';
|
1728
1749
|
request.pendingChunks++;
|
1729
|
-
|
1750
|
+
var componentDebugID = debugID;
|
1751
|
+
componentDebugInfo = {
|
1730
1752
|
name: componentName,
|
1731
|
-
env: request.environmentName
|
1732
|
-
|
1753
|
+
env: request.environmentName,
|
1754
|
+
owner: owner
|
1755
|
+
}; // We outline this model eagerly so that we can refer to by reference as an owner.
|
1756
|
+
// If we had a smarter way to dedupe we might not have to do this if there ends up
|
1757
|
+
// being no references to this as an owner.
|
1758
|
+
|
1759
|
+
outlineModel(request, componentDebugInfo);
|
1760
|
+
emitDebugChunk(request, componentDebugID, componentDebugInfo);
|
1733
1761
|
}
|
1734
1762
|
}
|
1735
1763
|
|
1736
|
-
prepareToUseHooksForComponent(prevThenableState); // The secondArg is always undefined in Server Components since refs error early.
|
1764
|
+
prepareToUseHooksForComponent(prevThenableState, componentDebugInfo); // The secondArg is always undefined in Server Components since refs error early.
|
1737
1765
|
|
1738
1766
|
var secondArg = undefined;
|
1739
|
-
var result
|
1767
|
+
var result;
|
1768
|
+
|
1769
|
+
{
|
1770
|
+
ReactCurrentOwner.current = componentDebugInfo;
|
1771
|
+
|
1772
|
+
try {
|
1773
|
+
result = Component(props, secondArg);
|
1774
|
+
} finally {
|
1775
|
+
ReactCurrentOwner.current = null;
|
1776
|
+
}
|
1777
|
+
}
|
1740
1778
|
|
1741
1779
|
if (typeof result === 'object' && result !== null && typeof result.then === 'function') {
|
1742
1780
|
// When the return value is in children position we can resolve it immediately,
|
@@ -1827,7 +1865,8 @@ function renderFragment(request, task, children) {
|
|
1827
1865
|
return children;
|
1828
1866
|
}
|
1829
1867
|
|
1830
|
-
function renderClientElement(task, type, key, props)
|
1868
|
+
function renderClientElement(task, type, key, props, owner) // DEV-only
|
1869
|
+
{
|
1831
1870
|
// the keys of any Server Components which are not serialized.
|
1832
1871
|
|
1833
1872
|
|
@@ -1839,7 +1878,7 @@ function renderClientElement(task, type, key, props) {
|
|
1839
1878
|
key = keyPath + ',' + key;
|
1840
1879
|
}
|
1841
1880
|
|
1842
|
-
var element = [REACT_ELEMENT_TYPE, type, key, props];
|
1881
|
+
var element = [REACT_ELEMENT_TYPE, type, key, props, owner] ;
|
1843
1882
|
|
1844
1883
|
if (task.implicitSlot && key !== null) {
|
1845
1884
|
// The root Server Component had no key so it was in an implicit slot.
|
@@ -1877,7 +1916,8 @@ function outlineTask(request, task) {
|
|
1877
1916
|
return serializeLazyID(newTask.id);
|
1878
1917
|
}
|
1879
1918
|
|
1880
|
-
function renderElement(request, task, type, key, ref, props)
|
1919
|
+
function renderElement(request, task, type, key, ref, props, owner) // DEV only
|
1920
|
+
{
|
1881
1921
|
if (ref !== null && ref !== undefined) {
|
1882
1922
|
// When the ref moves to the regular props object this will implicitly
|
1883
1923
|
// throw for functions. We could probably relax it to a DEV warning for other
|
@@ -1898,14 +1938,14 @@ function renderElement(request, task, type, key, ref, props) {
|
|
1898
1938
|
if (typeof type === 'function') {
|
1899
1939
|
if (isClientReference(type) || isTemporaryReference(type)) {
|
1900
1940
|
// This is a reference to a Client Component.
|
1901
|
-
return renderClientElement(task, type, key, props);
|
1941
|
+
return renderClientElement(task, type, key, props, owner);
|
1902
1942
|
} // This is a Server Component.
|
1903
1943
|
|
1904
1944
|
|
1905
|
-
return renderFunctionComponent(request, task, key, type, props);
|
1945
|
+
return renderFunctionComponent(request, task, key, type, props, owner);
|
1906
1946
|
} else if (typeof type === 'string') {
|
1907
1947
|
// This is a host element. E.g. HTML.
|
1908
|
-
return renderClientElement(task, type, key, props);
|
1948
|
+
return renderClientElement(task, type, key, props, owner);
|
1909
1949
|
} else if (typeof type === 'symbol') {
|
1910
1950
|
if (type === REACT_FRAGMENT_TYPE && key === null) {
|
1911
1951
|
// For key-less fragments, we add a small optimization to avoid serializing
|
@@ -1923,11 +1963,11 @@ function renderElement(request, task, type, key, ref, props) {
|
|
1923
1963
|
// Any built-in works as long as its props are serializable.
|
1924
1964
|
|
1925
1965
|
|
1926
|
-
return renderClientElement(task, type, key, props);
|
1966
|
+
return renderClientElement(task, type, key, props, owner);
|
1927
1967
|
} else if (type != null && typeof type === 'object') {
|
1928
1968
|
if (isClientReference(type)) {
|
1929
1969
|
// This is a reference to a Client Component.
|
1930
|
-
return renderClientElement(task, type, key, props);
|
1970
|
+
return renderClientElement(task, type, key, props, owner);
|
1931
1971
|
}
|
1932
1972
|
|
1933
1973
|
switch (type.$$typeof) {
|
@@ -1936,17 +1976,17 @@ function renderElement(request, task, type, key, ref, props) {
|
|
1936
1976
|
var payload = type._payload;
|
1937
1977
|
var init = type._init;
|
1938
1978
|
var wrappedType = init(payload);
|
1939
|
-
return renderElement(request, task, wrappedType, key, ref, props);
|
1979
|
+
return renderElement(request, task, wrappedType, key, ref, props, owner);
|
1940
1980
|
}
|
1941
1981
|
|
1942
1982
|
case REACT_FORWARD_REF_TYPE:
|
1943
1983
|
{
|
1944
|
-
return renderFunctionComponent(request, task, key, type.render, props);
|
1984
|
+
return renderFunctionComponent(request, task, key, type.render, props, owner);
|
1945
1985
|
}
|
1946
1986
|
|
1947
1987
|
case REACT_MEMO_TYPE:
|
1948
1988
|
{
|
1949
|
-
return renderElement(request, task, type.type, key, ref, props);
|
1989
|
+
return renderElement(request, task, type.type, key, ref, props, owner);
|
1950
1990
|
}
|
1951
1991
|
}
|
1952
1992
|
}
|
@@ -2025,6 +2065,10 @@ function serializeLazyID(id) {
|
|
2025
2065
|
return '$L' + id.toString(16);
|
2026
2066
|
}
|
2027
2067
|
|
2068
|
+
function serializeInfinitePromise() {
|
2069
|
+
return '$@';
|
2070
|
+
}
|
2071
|
+
|
2028
2072
|
function serializePromiseID(id) {
|
2029
2073
|
return '$@' + id.toString(16);
|
2030
2074
|
}
|
@@ -2189,6 +2233,12 @@ function serializeMap(request, map) {
|
|
2189
2233
|
return '$Q' + id.toString(16);
|
2190
2234
|
}
|
2191
2235
|
|
2236
|
+
function serializeFormData(request, formData) {
|
2237
|
+
var entries = Array.from(formData.entries());
|
2238
|
+
var id = outlineModel(request, entries);
|
2239
|
+
return '$K' + id.toString(16);
|
2240
|
+
}
|
2241
|
+
|
2192
2242
|
function serializeSet(request, set) {
|
2193
2243
|
var entries = Array.from(set);
|
2194
2244
|
|
@@ -2365,7 +2415,7 @@ function renderModelDestructive(request, task, parent, parentPropertyName, value
|
|
2365
2415
|
|
2366
2416
|
|
2367
2417
|
return renderElement(request, task, element.type, // $FlowFixMe[incompatible-call] the key of an element is null | string
|
2368
|
-
element.key, ref, props);
|
2418
|
+
element.key, ref, props, element._owner );
|
2369
2419
|
}
|
2370
2420
|
|
2371
2421
|
case REACT_LAZY_TYPE:
|
@@ -2463,6 +2513,11 @@ function renderModelDestructive(request, task, parent, parentPropertyName, value
|
|
2463
2513
|
|
2464
2514
|
if (value instanceof Set) {
|
2465
2515
|
return serializeSet(request, value);
|
2516
|
+
} // TODO: FormData is not available in old Node. Remove the typeof later.
|
2517
|
+
|
2518
|
+
|
2519
|
+
if (typeof FormData === 'function' && value instanceof FormData) {
|
2520
|
+
return serializeFormData(request, value);
|
2466
2521
|
}
|
2467
2522
|
|
2468
2523
|
var iteratorFn = getIteratorFn(value);
|
@@ -2726,14 +2781,216 @@ function emitModelChunk(request, id, json) {
|
|
2726
2781
|
}
|
2727
2782
|
|
2728
2783
|
function emitDebugChunk(request, id, debugInfo) {
|
2784
|
+
// use the full serialization that requires a task.
|
2785
|
+
|
2786
|
+
|
2787
|
+
var counter = {
|
2788
|
+
objectCount: 0
|
2789
|
+
};
|
2729
2790
|
|
2791
|
+
function replacer(parentPropertyName, value) {
|
2792
|
+
return renderConsoleValue(request, counter, this, parentPropertyName, value);
|
2793
|
+
} // $FlowFixMe[incompatible-type] stringify can return null
|
2730
2794
|
|
2731
|
-
|
2795
|
+
|
2796
|
+
var json = stringify(debugInfo, replacer);
|
2732
2797
|
var row = serializeRowHeader('D', id) + json + '\n';
|
2733
2798
|
var processedChunk = stringToChunk(row);
|
2734
2799
|
request.completedRegularChunks.push(processedChunk);
|
2735
2800
|
}
|
2736
2801
|
|
2802
|
+
function serializeEval(source) {
|
2803
|
+
|
2804
|
+
return '$E' + source;
|
2805
|
+
} // This is a forked version of renderModel which should never error, never suspend and is limited
|
2806
|
+
// in the depth it can encode.
|
2807
|
+
|
2808
|
+
|
2809
|
+
function renderConsoleValue(request, counter, parent, parentPropertyName, value) {
|
2810
|
+
// Make sure that `parent[parentPropertyName]` wasn't JSONified before `value` was passed to us
|
2811
|
+
// $FlowFixMe[incompatible-use]
|
2812
|
+
var originalValue = parent[parentPropertyName];
|
2813
|
+
|
2814
|
+
if (value === null) {
|
2815
|
+
return null;
|
2816
|
+
}
|
2817
|
+
|
2818
|
+
if (typeof value === 'object') {
|
2819
|
+
if (isClientReference(value)) {
|
2820
|
+
// We actually have this value on the client so we could import it.
|
2821
|
+
// This might be confusing though because on the Server it won't actually
|
2822
|
+
// be this value, so if you're debugging client references maybe you'd be
|
2823
|
+
// better with a place holder.
|
2824
|
+
return serializeClientReference(request, parent, parentPropertyName, value);
|
2825
|
+
}
|
2826
|
+
|
2827
|
+
if (counter.objectCount > 20) {
|
2828
|
+
// We've reached our max number of objects to serialize across the wire so we serialize this
|
2829
|
+
// object but no properties inside of it, as a place holder.
|
2830
|
+
return Array.isArray(value) ? [] : {};
|
2831
|
+
}
|
2832
|
+
|
2833
|
+
counter.objectCount++;
|
2834
|
+
var writtenObjects = request.writtenObjects;
|
2835
|
+
var existingId = writtenObjects.get(value); // $FlowFixMe[method-unbinding]
|
2836
|
+
|
2837
|
+
if (typeof value.then === 'function') {
|
2838
|
+
if (existingId !== undefined) {
|
2839
|
+
// We've seen this promise before, so we can just refer to the same result.
|
2840
|
+
return serializePromiseID(existingId);
|
2841
|
+
}
|
2842
|
+
|
2843
|
+
var thenable = value;
|
2844
|
+
|
2845
|
+
switch (thenable.status) {
|
2846
|
+
case 'fulfilled':
|
2847
|
+
{
|
2848
|
+
return serializePromiseID(outlineConsoleValue(request, counter, thenable.value));
|
2849
|
+
}
|
2850
|
+
|
2851
|
+
case 'rejected':
|
2852
|
+
{
|
2853
|
+
var x = thenable.reason;
|
2854
|
+
request.pendingChunks++;
|
2855
|
+
var errorId = request.nextChunkId++;
|
2856
|
+
|
2857
|
+
{
|
2858
|
+
// We don't log these errors since they didn't actually throw into Flight.
|
2859
|
+
var digest = '';
|
2860
|
+
emitErrorChunk(request, errorId, digest, x);
|
2861
|
+
}
|
2862
|
+
|
2863
|
+
return serializePromiseID(errorId);
|
2864
|
+
}
|
2865
|
+
} // If it hasn't already resolved (and been instrumented) we just encode an infinite
|
2866
|
+
// promise that will never resolve.
|
2867
|
+
|
2868
|
+
|
2869
|
+
return serializeInfinitePromise();
|
2870
|
+
}
|
2871
|
+
|
2872
|
+
if (existingId !== undefined && existingId >= 0) {
|
2873
|
+
// We've already emitted this as a real object, so we can
|
2874
|
+
// just refer to that by its existing ID.
|
2875
|
+
return serializeByValueID(existingId);
|
2876
|
+
}
|
2877
|
+
|
2878
|
+
if (isArray(value)) {
|
2879
|
+
return value;
|
2880
|
+
}
|
2881
|
+
|
2882
|
+
if (value instanceof Map) {
|
2883
|
+
return serializeMap(request, value);
|
2884
|
+
}
|
2885
|
+
|
2886
|
+
if (value instanceof Set) {
|
2887
|
+
return serializeSet(request, value);
|
2888
|
+
} // TODO: FormData is not available in old Node. Remove the typeof later.
|
2889
|
+
|
2890
|
+
|
2891
|
+
if (typeof FormData === 'function' && value instanceof FormData) {
|
2892
|
+
return serializeFormData(request, value);
|
2893
|
+
}
|
2894
|
+
|
2895
|
+
var iteratorFn = getIteratorFn(value);
|
2896
|
+
|
2897
|
+
if (iteratorFn) {
|
2898
|
+
return Array.from(value);
|
2899
|
+
} // $FlowFixMe[incompatible-return]
|
2900
|
+
|
2901
|
+
|
2902
|
+
return value;
|
2903
|
+
}
|
2904
|
+
|
2905
|
+
if (typeof value === 'string') {
|
2906
|
+
if (value[value.length - 1] === 'Z') {
|
2907
|
+
// Possibly a Date, whose toJSON automatically calls toISOString
|
2908
|
+
if (originalValue instanceof Date) {
|
2909
|
+
return serializeDateFromDateJSON(value);
|
2910
|
+
}
|
2911
|
+
}
|
2912
|
+
|
2913
|
+
if (value.length >= 1024) {
|
2914
|
+
// For large strings, we encode them outside the JSON payload so that we
|
2915
|
+
// don't have to double encode and double parse the strings. This can also
|
2916
|
+
// be more compact in case the string has a lot of escaped characters.
|
2917
|
+
return serializeLargeTextString(request, value);
|
2918
|
+
}
|
2919
|
+
|
2920
|
+
return escapeStringValue(value);
|
2921
|
+
}
|
2922
|
+
|
2923
|
+
if (typeof value === 'boolean') {
|
2924
|
+
return value;
|
2925
|
+
}
|
2926
|
+
|
2927
|
+
if (typeof value === 'number') {
|
2928
|
+
return serializeNumber(value);
|
2929
|
+
}
|
2930
|
+
|
2931
|
+
if (typeof value === 'undefined') {
|
2932
|
+
return serializeUndefined();
|
2933
|
+
}
|
2934
|
+
|
2935
|
+
if (typeof value === 'function') {
|
2936
|
+
if (isClientReference(value)) {
|
2937
|
+
return serializeClientReference(request, parent, parentPropertyName, value);
|
2938
|
+
}
|
2939
|
+
|
2940
|
+
if (isTemporaryReference(value)) {
|
2941
|
+
return serializeTemporaryReference(request, value);
|
2942
|
+
} // Serialize the body of the function as an eval so it can be printed.
|
2943
|
+
// $FlowFixMe[method-unbinding]
|
2944
|
+
|
2945
|
+
|
2946
|
+
return serializeEval('(' + Function.prototype.toString.call(value) + ')');
|
2947
|
+
}
|
2948
|
+
|
2949
|
+
if (typeof value === 'symbol') {
|
2950
|
+
var writtenSymbols = request.writtenSymbols;
|
2951
|
+
|
2952
|
+
var _existingId3 = writtenSymbols.get(value);
|
2953
|
+
|
2954
|
+
if (_existingId3 !== undefined) {
|
2955
|
+
return serializeByValueID(_existingId3);
|
2956
|
+
} // $FlowFixMe[incompatible-type] `description` might be undefined
|
2957
|
+
|
2958
|
+
|
2959
|
+
var name = value.description; // We use the Symbol.for version if it's not a global symbol. Close enough.
|
2960
|
+
|
2961
|
+
request.pendingChunks++;
|
2962
|
+
var symbolId = request.nextChunkId++;
|
2963
|
+
emitSymbolChunk(request, symbolId, name);
|
2964
|
+
return serializeByValueID(symbolId);
|
2965
|
+
}
|
2966
|
+
|
2967
|
+
if (typeof value === 'bigint') {
|
2968
|
+
return serializeBigInt(value);
|
2969
|
+
}
|
2970
|
+
|
2971
|
+
return 'unknown type ' + typeof value;
|
2972
|
+
}
|
2973
|
+
|
2974
|
+
function outlineConsoleValue(request, counter, model) {
|
2975
|
+
|
2976
|
+
function replacer(parentPropertyName, value) {
|
2977
|
+
try {
|
2978
|
+
return renderConsoleValue(request, counter, this, parentPropertyName, value);
|
2979
|
+
} catch (x) {
|
2980
|
+
return 'unknown value';
|
2981
|
+
}
|
2982
|
+
} // $FlowFixMe[incompatible-type] stringify can return null
|
2983
|
+
|
2984
|
+
|
2985
|
+
var json = stringify(model, replacer);
|
2986
|
+
request.pendingChunks++;
|
2987
|
+
var id = request.nextChunkId++;
|
2988
|
+
var row = id.toString(16) + ':' + json + '\n';
|
2989
|
+
var processedChunk = stringToChunk(row);
|
2990
|
+
request.completedRegularChunks.push(processedChunk);
|
2991
|
+
return id;
|
2992
|
+
}
|
2993
|
+
|
2737
2994
|
function forwardDebugInfo(request, id, debugInfo) {
|
2738
2995
|
for (var i = 0; i < debugInfo.length; i++) {
|
2739
2996
|
request.pendingChunks++;
|
@@ -477,6 +477,7 @@ const ReactDOMSharedInternals = ReactDOM.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WI
|
|
477
477
|
const ReactDOMCurrentDispatcher = ReactDOMSharedInternals.ReactDOMCurrentDispatcher;
|
478
478
|
const previousDispatcher = ReactDOMCurrentDispatcher.current;
|
479
479
|
ReactDOMCurrentDispatcher.current = {
|
480
|
+
flushSyncWork: previousDispatcher.flushSyncWork,
|
480
481
|
prefetchDNS,
|
481
482
|
preconnect,
|
482
483
|
preload,
|
@@ -950,7 +951,7 @@ function prepareToUseHooksForRequest(request) {
|
|
950
951
|
function resetHooksForRequest() {
|
951
952
|
currentRequest$1 = null;
|
952
953
|
}
|
953
|
-
function prepareToUseHooksForComponent(prevThenableState) {
|
954
|
+
function prepareToUseHooksForComponent(prevThenableState, componentDebugInfo) {
|
954
955
|
thenableIndexCounter = 0;
|
955
956
|
thenableState = prevThenableState;
|
956
957
|
}
|
@@ -959,6 +960,7 @@ function getThenableStateAfterSuspending() {
|
|
959
960
|
// which is not really supported anymore, it will be empty. We use the empty set as a
|
960
961
|
// marker to know if this was a replay of the same component or first attempt.
|
961
962
|
const state = thenableState || createThenableState();
|
963
|
+
|
962
964
|
thenableState = null;
|
963
965
|
return state;
|
964
966
|
}
|
@@ -1518,7 +1520,7 @@ function createLazyWrapperAroundWakeable(wakeable) {
|
|
1518
1520
|
return lazyType;
|
1519
1521
|
}
|
1520
1522
|
|
1521
|
-
function renderFunctionComponent(request, task, key, Component, props) {
|
1523
|
+
function renderFunctionComponent(request, task, key, Component, props, owner) {
|
1522
1524
|
// Reset the task's thenable state before continuing, so that if a later
|
1523
1525
|
// component suspends we can reuse the same task object. If the same
|
1524
1526
|
// component suspends again, the thenable state will be restored.
|
@@ -1528,7 +1530,11 @@ function renderFunctionComponent(request, task, key, Component, props) {
|
|
1528
1530
|
prepareToUseHooksForComponent(prevThenableState); // The secondArg is always undefined in Server Components since refs error early.
|
1529
1531
|
|
1530
1532
|
const secondArg = undefined;
|
1531
|
-
let result
|
1533
|
+
let result;
|
1534
|
+
|
1535
|
+
{
|
1536
|
+
result = Component(props, secondArg);
|
1537
|
+
}
|
1532
1538
|
|
1533
1539
|
if (typeof result === 'object' && result !== null && typeof result.then === 'function') {
|
1534
1540
|
// When the return value is in children position we can resolve it immediately,
|
@@ -1602,7 +1608,8 @@ function renderFragment(request, task, children) {
|
|
1602
1608
|
return children;
|
1603
1609
|
}
|
1604
1610
|
|
1605
|
-
function renderClientElement(task, type, key, props)
|
1611
|
+
function renderClientElement(task, type, key, props, owner) // DEV-only
|
1612
|
+
{
|
1606
1613
|
// the keys of any Server Components which are not serialized.
|
1607
1614
|
|
1608
1615
|
|
@@ -1635,7 +1642,8 @@ function renderClientElement(task, type, key, props) {
|
|
1635
1642
|
|
1636
1643
|
let debugID = null;
|
1637
1644
|
|
1638
|
-
function renderElement(request, task, type, key, ref, props)
|
1645
|
+
function renderElement(request, task, type, key, ref, props, owner) // DEV only
|
1646
|
+
{
|
1639
1647
|
if (ref !== null && ref !== undefined) {
|
1640
1648
|
// When the ref moves to the regular props object this will implicitly
|
1641
1649
|
// throw for functions. We could probably relax it to a DEV warning for other
|
@@ -1916,6 +1924,12 @@ function serializeMap(request, map) {
|
|
1916
1924
|
return '$Q' + id.toString(16);
|
1917
1925
|
}
|
1918
1926
|
|
1927
|
+
function serializeFormData(request, formData) {
|
1928
|
+
const entries = Array.from(formData.entries());
|
1929
|
+
const id = outlineModel(request, entries);
|
1930
|
+
return '$K' + id.toString(16);
|
1931
|
+
}
|
1932
|
+
|
1919
1933
|
function serializeSet(request, set) {
|
1920
1934
|
const entries = Array.from(set);
|
1921
1935
|
|
@@ -2152,6 +2166,11 @@ function renderModelDestructive(request, task, parent, parentPropertyName, value
|
|
2152
2166
|
|
2153
2167
|
if (value instanceof Set) {
|
2154
2168
|
return serializeSet(request, value);
|
2169
|
+
} // TODO: FormData is not available in old Node. Remove the typeof later.
|
2170
|
+
|
2171
|
+
|
2172
|
+
if (typeof FormData === 'function' && value instanceof FormData) {
|
2173
|
+
return serializeFormData(request, value);
|
2155
2174
|
}
|
2156
2175
|
|
2157
2176
|
const iteratorFn = getIteratorFn(value);
|
@@ -17,7 +17,7 @@ function ma(a,b){switch(b){case "$$typeof":return a.$$typeof;case "$$id":return
|
|
17
17
|
},a.$$id+"#",a.$$async);return!0;case "then":if(a.then)return a.then;if(a.$$async)return;var d=x({},a.$$id,!0),e=new Proxy(d,na);a.status="fulfilled";a.value=e;return a.then=x(function(f){return Promise.resolve(f(e))},a.$$id+"#then",!1)}if("symbol"===typeof b)throw Error("Cannot read Symbol exports. Only named exports are supported on a client module imported on the server.");d=a[b];d||(d=x(function(){throw Error("Attempted to call "+String(b)+"() from the server but "+String(b)+" is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.");
|
18
18
|
},a.$$id+"#"+b,a.$$async),Object.defineProperty(d,"name",{value:b}),d=a[b]=new Proxy(d,la));return d}
|
19
19
|
var na={get:function(a,b){return ma(a,b)},getOwnPropertyDescriptor:function(a,b){var c=Object.getOwnPropertyDescriptor(a,b);c||(c={value:ma(a,b),writable:!1,configurable:!1,enumerable:!1},Object.defineProperty(a,b,c));return c},getPrototypeOf:function(){return ka},set:function(){throw Error("Cannot assign to a client module from a server module.");}},oa=da.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactDOMCurrentDispatcher,y=oa.current;
|
20
|
-
oa.current={prefetchDNS:pa,preconnect:qa,preload:ra,preloadModule:sa,preinitStyle:ta,preinitScript:ua,preinitModuleScript:va};function pa(a){if("string"===typeof a&&a){var b=z();if(b){var c=b.hints,d="D|"+a;c.has(d)||(c.add(d),A(b,"D",a))}else y.prefetchDNS(a)}}function qa(a,b){if("string"===typeof a){var c=z();if(c){var d=c.hints,e="C|"+(null==b?"null":b)+"|"+a;d.has(e)||(d.add(e),"string"===typeof b?A(c,"C",[a,b]):A(c,"C",a))}else y.preconnect(a,b)}}
|
20
|
+
oa.current={flushSyncWork:y.flushSyncWork,prefetchDNS:pa,preconnect:qa,preload:ra,preloadModule:sa,preinitStyle:ta,preinitScript:ua,preinitModuleScript:va};function pa(a){if("string"===typeof a&&a){var b=z();if(b){var c=b.hints,d="D|"+a;c.has(d)||(c.add(d),A(b,"D",a))}else y.prefetchDNS(a)}}function qa(a,b){if("string"===typeof a){var c=z();if(c){var d=c.hints,e="C|"+(null==b?"null":b)+"|"+a;d.has(e)||(d.add(e),"string"===typeof b?A(c,"C",[a,b]):A(c,"C",a))}else y.preconnect(a,b)}}
|
21
21
|
function ra(a,b,c){if("string"===typeof a){var d=z();if(d){var e=d.hints,f="L";if("image"===b&&c){var g=c.imageSrcSet,k=c.imageSizes,h="";"string"===typeof g&&""!==g?(h+="["+g+"]","string"===typeof k&&(h+="["+k+"]")):h+="[][]"+a;f+="[image]"+h}else f+="["+b+"]"+a;e.has(f)||(e.add(f),(c=B(c))?A(d,"L",[a,b,c]):A(d,"L",[a,b]))}else y.preload(a,b,c)}}
|
22
22
|
function sa(a,b){if("string"===typeof a){var c=z();if(c){var d=c.hints,e="m|"+a;if(d.has(e))return;d.add(e);return(b=B(b))?A(c,"m",[a,b]):A(c,"m",a)}y.preloadModule(a,b)}}function ta(a,b,c){if("string"===typeof a){var d=z();if(d){var e=d.hints,f="S|"+a;if(e.has(f))return;e.add(f);return(c=B(c))?A(d,"S",[a,"string"===typeof b?b:0,c]):"string"===typeof b?A(d,"S",[a,b]):A(d,"S",a)}y.preinitStyle(a,b,c)}}
|
23
23
|
function ua(a,b){if("string"===typeof a){var c=z();if(c){var d=c.hints,e="X|"+a;if(d.has(e))return;d.add(e);return(b=B(b))?A(c,"X",[a,b]):A(c,"X",a)}y.preinitScript(a,b)}}function va(a,b){if("string"===typeof a){var c=z();if(c){var d=c.hints,e="M|"+a;if(d.has(e))return;d.add(e);return(b=B(b))?A(c,"M",[a,b]):A(c,"M",a)}y.preinitModuleScript(a,b)}}function B(a){if(null==a)return null;var b=!1,c={},d;for(d in a)null!=a[d]&&(b=!0,c[d]=a[d]);return b?c:null}
|
@@ -51,7 +51,7 @@ function rb(a,b,c,d){var e=d.$$async?d.$$id+"#async":d.$$id,f=a.writtenClientRef
|
|
51
51
|
g];a.pendingChunks++;var D=a.nextChunkId++,ba=L(n),Ob=D.toString(16)+":I"+ba+"\n";a.completedImportChunks.push(Ob);f.set(e,D);return b[0]===C&&"1"===c?"$L"+D.toString(16):T(D)}catch(Pb){return a.pendingChunks++,b=a.nextChunkId++,c=O(a,Pb),P(a,b,c),T(b)}}function U(a,b){b=M(a,b,null,!1,a.abortableTasks);sb(a,b);return b.id}var V=!1;
|
52
52
|
function R(a,b,c,d,e){b.model=e;if(e===C)return"$";if(null===e)return null;if("object"===typeof e){switch(e.$$typeof){case C:c=a.writtenObjects;d=c.get(e);if(void 0!==d){if(null===b.keyPath&&!b.implicitSlot)if(V===e)V=null;else return-1===d?(a=U(a,e),T(a)):T(d)}else c.set(e,-1),c.set(e.props,-2);c=e.props;d=c.ref;return ob(a,b,e.type,e.key,void 0!==d?d:null,c);case E:return b.thenableState=null,c=e._init,e=c(e._payload),R(a,b,S,"",e)}if(e.$$typeof===v)return rb(a,c,d,e);c=a.writtenObjects;d=c.get(e);
|
53
53
|
if("function"===typeof e.then){if(void 0!==d){if(null!==b.keyPath||b.implicitSlot)return"$@"+gb(a,b,e).toString(16);if(V===e)V=null;else return"$@"+d.toString(16)}a=gb(a,b,e);c.set(e,a);return"$@"+a.toString(16)}if(void 0!==d)if(V===e)V=null;else{if(-1===d)return a=U(a,e),T(a);if(-2!==d)return T(d)}else c.set(e,-1);if(Ua(e))return mb(a,b,e);if(e instanceof Map){e=Array.from(e);for(b=0;b<e.length;b++)c=e[b][0],"object"===typeof c&&null!==c&&(d=a.writtenObjects,void 0===d.get(c)&&d.set(c,-1));return"$Q"+
|
54
|
-
U(a,e).toString(16)}if(e instanceof Set){e=Array.from(e);for(b=0;b<e.length;b++)c=e[b],"object"===typeof c&&null!==c&&(d=a.writtenObjects,void 0===d.get(c)&&d.set(c,-1));return"$W"+U(a,e).toString(16)}null===e||"object"!==typeof e?c=null:(c=Ha&&e[Ha]||e["@@iterator"],c="function"===typeof c?c:null);if(c)return mb(a,b,Array.from(e));a=Va(e);if(a!==ab&&(null===a||null!==Va(a)))throw Error("Only plain objects, and a few built-ins, can be passed to Client Components from Server Components. Classes or null prototypes are not supported.");
|
54
|
+
U(a,e).toString(16)}if(e instanceof Set){e=Array.from(e);for(b=0;b<e.length;b++)c=e[b],"object"===typeof c&&null!==c&&(d=a.writtenObjects,void 0===d.get(c)&&d.set(c,-1));return"$W"+U(a,e).toString(16)}if("function"===typeof FormData&&e instanceof FormData)return e=Array.from(e.entries()),"$K"+U(a,e).toString(16);null===e||"object"!==typeof e?c=null:(c=Ha&&e[Ha]||e["@@iterator"],c="function"===typeof c?c:null);if(c)return mb(a,b,Array.from(e));a=Va(e);if(a!==ab&&(null===a||null!==Va(a)))throw Error("Only plain objects, and a few built-ins, can be passed to Client Components from Server Components. Classes or null prototypes are not supported.");
|
55
55
|
return e}if("string"===typeof e){if("Z"===e[e.length-1]&&c[d]instanceof Date)return"$D"+e;if(1024<=e.length)return a.pendingChunks+=2,b=a.nextChunkId++,c="string"===typeof e?Buffer.byteLength(e,"utf8"):e.byteLength,c=b.toString(16)+":T"+c.toString(16)+",",a.completedRegularChunks.push(c,e),T(b);a="$"===e[0]?"$"+e:e;return a}if("boolean"===typeof e)return e;if("number"===typeof e)return Number.isFinite(e)?0===e&&-Infinity===1/e?"$-0":e:Infinity===e?"$Infinity":-Infinity===e?"$-Infinity":"$NaN";if("undefined"===
|
56
56
|
typeof e)return"$undefined";if("function"===typeof e){if(e.$$typeof===v)return rb(a,c,d,e);if(e.$$typeof===w)return b=a.writtenServerReferences,c=b.get(e),void 0!==c?a="$F"+c.toString(16):(c=e.$$bound,c={id:e.$$id,bound:c?Promise.resolve(c):null},a=U(a,c),b.set(e,a),a="$F"+a.toString(16)),a;if(e.$$typeof===xa)return"$T"+e.$$id;if(/^on[A-Z]/.test(d))throw Error("Event handlers cannot be passed to Client Component props."+K(c,d)+"\nIf you need interactivity, consider converting part of this to a Client Component.");
|
57
57
|
throw Error('Functions cannot be passed directly to Client Components unless you explicitly expose it by marking it with "use server". Or maybe you meant to call this function rather than return it.'+K(c,d));}if("symbol"===typeof e){b=a.writtenSymbols;var f=b.get(e);if(void 0!==f)return T(f);f=e.description;if(Symbol.for(f)!==e)throw Error("Only global symbols received from Symbol.for(...) can be passed to Client Components. The symbol Symbol.for("+(e.description+") cannot be found among global symbols.")+
|