react-server-dom-webpack 19.2.0-canary-b4477d38-20250605 → 19.2.0-canary-280ff6fe-20250606

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.
@@ -2786,10 +2786,10 @@
2786
2786
  return hook.checkDCE ? !0 : !1;
2787
2787
  })({
2788
2788
  bundleType: 1,
2789
- version: "19.2.0-canary-b4477d38-20250605",
2789
+ version: "19.2.0-canary-280ff6fe-20250606",
2790
2790
  rendererPackageName: "react-server-dom-webpack",
2791
2791
  currentDispatcherRef: ReactSharedInternals,
2792
- reconcilerVersion: "19.2.0-canary-b4477d38-20250605",
2792
+ reconcilerVersion: "19.2.0-canary-280ff6fe-20250606",
2793
2793
  getCurrentComponentInfo: function () {
2794
2794
  return currentOwnerInDEV;
2795
2795
  }
@@ -2593,6 +2593,85 @@
2593
2593
  resolveModel(response, id, row);
2594
2594
  }
2595
2595
  }
2596
+ function processBinaryChunk(response, chunk) {
2597
+ for (
2598
+ var i = 0,
2599
+ rowState = response._rowState,
2600
+ rowID = response._rowID,
2601
+ rowTag = response._rowTag,
2602
+ rowLength = response._rowLength,
2603
+ buffer = response._buffer,
2604
+ chunkLength = chunk.length;
2605
+ i < chunkLength;
2606
+
2607
+ ) {
2608
+ var lastIdx = -1;
2609
+ switch (rowState) {
2610
+ case 0:
2611
+ lastIdx = chunk[i++];
2612
+ 58 === lastIdx
2613
+ ? (rowState = 1)
2614
+ : (rowID =
2615
+ (rowID << 4) | (96 < lastIdx ? lastIdx - 87 : lastIdx - 48));
2616
+ continue;
2617
+ case 1:
2618
+ rowState = chunk[i];
2619
+ 84 === rowState ||
2620
+ 65 === rowState ||
2621
+ 79 === rowState ||
2622
+ 111 === rowState ||
2623
+ 85 === rowState ||
2624
+ 83 === rowState ||
2625
+ 115 === rowState ||
2626
+ 76 === rowState ||
2627
+ 108 === rowState ||
2628
+ 71 === rowState ||
2629
+ 103 === rowState ||
2630
+ 77 === rowState ||
2631
+ 109 === rowState ||
2632
+ 86 === rowState
2633
+ ? ((rowTag = rowState), (rowState = 2), i++)
2634
+ : (64 < rowState && 91 > rowState) ||
2635
+ 35 === rowState ||
2636
+ 114 === rowState ||
2637
+ 120 === rowState
2638
+ ? ((rowTag = rowState), (rowState = 3), i++)
2639
+ : ((rowTag = 0), (rowState = 3));
2640
+ continue;
2641
+ case 2:
2642
+ lastIdx = chunk[i++];
2643
+ 44 === lastIdx
2644
+ ? (rowState = 4)
2645
+ : (rowLength =
2646
+ (rowLength << 4) |
2647
+ (96 < lastIdx ? lastIdx - 87 : lastIdx - 48));
2648
+ continue;
2649
+ case 3:
2650
+ lastIdx = chunk.indexOf(10, i);
2651
+ break;
2652
+ case 4:
2653
+ (lastIdx = i + rowLength), lastIdx > chunk.length && (lastIdx = -1);
2654
+ }
2655
+ var offset = chunk.byteOffset + i;
2656
+ if (-1 < lastIdx)
2657
+ (rowLength = new Uint8Array(chunk.buffer, offset, lastIdx - i)),
2658
+ processFullBinaryRow(response, rowID, rowTag, buffer, rowLength),
2659
+ (i = lastIdx),
2660
+ 3 === rowState && i++,
2661
+ (rowLength = rowID = rowTag = rowState = 0),
2662
+ (buffer.length = 0);
2663
+ else {
2664
+ chunk = new Uint8Array(chunk.buffer, offset, chunk.byteLength - i);
2665
+ buffer.push(chunk);
2666
+ rowLength -= chunk.byteLength;
2667
+ break;
2668
+ }
2669
+ }
2670
+ response._rowState = rowState;
2671
+ response._rowID = rowID;
2672
+ response._rowTag = rowTag;
2673
+ response._rowLength = rowLength;
2674
+ }
2596
2675
  function createFromJSONCallback(response) {
2597
2676
  return function (key, value) {
2598
2677
  if ("string" === typeof value)
@@ -2703,6 +2782,46 @@
2703
2782
  return value;
2704
2783
  };
2705
2784
  }
2785
+ function close(response) {
2786
+ reportGlobalError(response, Error("Connection closed."));
2787
+ }
2788
+ function noServerCall$1() {
2789
+ throw Error(
2790
+ "Server Functions cannot be called during initial render. This would create a fetch waterfall. Try to use a Server Component to pass data to Client Components instead."
2791
+ );
2792
+ }
2793
+ function createResponseFromOptions(options) {
2794
+ return new ResponseInstance(
2795
+ options.serverConsumerManifest.moduleMap,
2796
+ options.serverConsumerManifest.serverModuleMap,
2797
+ options.serverConsumerManifest.moduleLoading,
2798
+ noServerCall$1,
2799
+ options.encodeFormAction,
2800
+ "string" === typeof options.nonce ? options.nonce : void 0,
2801
+ options && options.temporaryReferences
2802
+ ? options.temporaryReferences
2803
+ : void 0,
2804
+ options && options.findSourceMapURL ? options.findSourceMapURL : void 0,
2805
+ options ? !0 === options.replayConsoleLogs : !1,
2806
+ options && options.environmentName ? options.environmentName : void 0
2807
+ );
2808
+ }
2809
+ function startReadingFromStream(response, stream) {
2810
+ function progress(_ref) {
2811
+ var value = _ref.value;
2812
+ if (_ref.done) close(response);
2813
+ else
2814
+ return (
2815
+ processBinaryChunk(response, value),
2816
+ reader.read().then(progress).catch(error)
2817
+ );
2818
+ }
2819
+ function error(e) {
2820
+ reportGlobalError(response, e);
2821
+ }
2822
+ var reader = stream.getReader();
2823
+ reader.read().then(progress).catch(error);
2824
+ }
2706
2825
  function noServerCall() {
2707
2826
  throw Error(
2708
2827
  "Server Functions cannot be called during initial render. This would create a fetch waterfall. Try to use a Server Component to pass data to Client Components instead."
@@ -2882,6 +3001,18 @@
2882
3001
  replayConsoleWithCallStackInDEV = replayConsoleWithCallStack[
2883
3002
  "react-stack-bottom-frame"
2884
3003
  ].bind(replayConsoleWithCallStack);
3004
+ exports.createFromFetch = function (promiseForResponse, options) {
3005
+ var response = createResponseFromOptions(options);
3006
+ promiseForResponse.then(
3007
+ function (r) {
3008
+ startReadingFromStream(response, r.body);
3009
+ },
3010
+ function (e) {
3011
+ reportGlobalError(response, e);
3012
+ }
3013
+ );
3014
+ return getChunk(response, 0);
3015
+ };
2885
3016
  exports.createFromNodeStream = function (
2886
3017
  stream,
2887
3018
  serverConsumerManifest,
@@ -2987,102 +3118,50 @@
2987
3118
  response._rowID = rowID;
2988
3119
  response._rowTag = rowTag;
2989
3120
  response._rowLength = rowLength;
2990
- } else {
2991
- rowLength = 0;
2992
- chunkLength = response._rowState;
2993
- rowID = response._rowID;
2994
- i = response._rowTag;
2995
- rowState = response._rowLength;
2996
- buffer = response._buffer;
2997
- for (rowTag = chunk.length; rowLength < rowTag; ) {
2998
- lastIdx = -1;
2999
- switch (chunkLength) {
3000
- case 0:
3001
- lastIdx = chunk[rowLength++];
3002
- 58 === lastIdx
3003
- ? (chunkLength = 1)
3004
- : (rowID =
3005
- (rowID << 4) |
3006
- (96 < lastIdx ? lastIdx - 87 : lastIdx - 48));
3007
- continue;
3008
- case 1:
3009
- chunkLength = chunk[rowLength];
3010
- 84 === chunkLength ||
3011
- 65 === chunkLength ||
3012
- 79 === chunkLength ||
3013
- 111 === chunkLength ||
3014
- 85 === chunkLength ||
3015
- 83 === chunkLength ||
3016
- 115 === chunkLength ||
3017
- 76 === chunkLength ||
3018
- 108 === chunkLength ||
3019
- 71 === chunkLength ||
3020
- 103 === chunkLength ||
3021
- 77 === chunkLength ||
3022
- 109 === chunkLength ||
3023
- 86 === chunkLength
3024
- ? ((i = chunkLength), (chunkLength = 2), rowLength++)
3025
- : (64 < chunkLength && 91 > chunkLength) ||
3026
- 35 === chunkLength ||
3027
- 114 === chunkLength ||
3028
- 120 === chunkLength
3029
- ? ((i = chunkLength), (chunkLength = 3), rowLength++)
3030
- : ((i = 0), (chunkLength = 3));
3031
- continue;
3032
- case 2:
3033
- lastIdx = chunk[rowLength++];
3034
- 44 === lastIdx
3035
- ? (chunkLength = 4)
3036
- : (rowState =
3037
- (rowState << 4) |
3038
- (96 < lastIdx ? lastIdx - 87 : lastIdx - 48));
3039
- continue;
3040
- case 3:
3041
- lastIdx = chunk.indexOf(10, rowLength);
3042
- break;
3043
- case 4:
3044
- (lastIdx = rowLength + rowState),
3045
- lastIdx > chunk.length && (lastIdx = -1);
3046
- }
3047
- var offset = chunk.byteOffset + rowLength;
3048
- if (-1 < lastIdx)
3049
- (rowState = new Uint8Array(
3050
- chunk.buffer,
3051
- offset,
3052
- lastIdx - rowLength
3053
- )),
3054
- processFullBinaryRow(response, rowID, i, buffer, rowState),
3055
- (rowLength = lastIdx),
3056
- 3 === chunkLength && rowLength++,
3057
- (rowState = rowID = i = chunkLength = 0),
3058
- (buffer.length = 0);
3059
- else {
3060
- chunk = new Uint8Array(
3061
- chunk.buffer,
3062
- offset,
3063
- chunk.byteLength - rowLength
3064
- );
3065
- buffer.push(chunk);
3066
- rowState -= chunk.byteLength;
3067
- break;
3068
- }
3069
- }
3070
- response._rowState = chunkLength;
3071
- response._rowID = rowID;
3072
- response._rowTag = i;
3073
- response._rowLength = rowState;
3074
- }
3121
+ } else processBinaryChunk(response, chunk);
3075
3122
  });
3076
3123
  stream.on("error", function (error) {
3077
3124
  reportGlobalError(response, error);
3078
3125
  });
3079
3126
  stream.on("end", function () {
3080
- reportGlobalError(response, Error("Connection closed."));
3127
+ return close(response);
3081
3128
  });
3082
3129
  return getChunk(response, 0);
3083
3130
  };
3131
+ exports.createFromReadableStream = function (stream, options) {
3132
+ options = createResponseFromOptions(options);
3133
+ startReadingFromStream(options, stream);
3134
+ return getChunk(options, 0);
3135
+ };
3084
3136
  exports.createServerReference = function (id) {
3085
- return createServerReference$1(id, noServerCall);
3137
+ return createServerReference$1(id, noServerCall$1);
3138
+ };
3139
+ exports.createTemporaryReferenceSet = function () {
3140
+ return new Map();
3141
+ };
3142
+ exports.encodeReply = function (value, options) {
3143
+ return new Promise(function (resolve, reject) {
3144
+ var abort = processReply(
3145
+ value,
3146
+ "",
3147
+ options && options.temporaryReferences
3148
+ ? options.temporaryReferences
3149
+ : void 0,
3150
+ resolve,
3151
+ reject
3152
+ );
3153
+ if (options && options.signal) {
3154
+ var signal = options.signal;
3155
+ if (signal.aborted) abort(signal.reason);
3156
+ else {
3157
+ var listener = function () {
3158
+ abort(signal.reason);
3159
+ signal.removeEventListener("abort", listener);
3160
+ };
3161
+ signal.addEventListener("abort", listener);
3162
+ }
3163
+ }
3164
+ });
3086
3165
  };
3087
3166
  exports.registerServerReference = function (
3088
3167
  reference,
@@ -1647,6 +1647,84 @@ function processFullStringRow(response, id, tag, row) {
1647
1647
  );
1648
1648
  }
1649
1649
  }
1650
+ function processBinaryChunk(response, chunk) {
1651
+ for (
1652
+ var i = 0,
1653
+ rowState = response._rowState,
1654
+ rowID = response._rowID,
1655
+ rowTag = response._rowTag,
1656
+ rowLength = response._rowLength,
1657
+ buffer = response._buffer,
1658
+ chunkLength = chunk.length;
1659
+ i < chunkLength;
1660
+
1661
+ ) {
1662
+ var lastIdx = -1;
1663
+ switch (rowState) {
1664
+ case 0:
1665
+ lastIdx = chunk[i++];
1666
+ 58 === lastIdx
1667
+ ? (rowState = 1)
1668
+ : (rowID =
1669
+ (rowID << 4) | (96 < lastIdx ? lastIdx - 87 : lastIdx - 48));
1670
+ continue;
1671
+ case 1:
1672
+ rowState = chunk[i];
1673
+ 84 === rowState ||
1674
+ 65 === rowState ||
1675
+ 79 === rowState ||
1676
+ 111 === rowState ||
1677
+ 85 === rowState ||
1678
+ 83 === rowState ||
1679
+ 115 === rowState ||
1680
+ 76 === rowState ||
1681
+ 108 === rowState ||
1682
+ 71 === rowState ||
1683
+ 103 === rowState ||
1684
+ 77 === rowState ||
1685
+ 109 === rowState ||
1686
+ 86 === rowState
1687
+ ? ((rowTag = rowState), (rowState = 2), i++)
1688
+ : (64 < rowState && 91 > rowState) ||
1689
+ 35 === rowState ||
1690
+ 114 === rowState ||
1691
+ 120 === rowState
1692
+ ? ((rowTag = rowState), (rowState = 3), i++)
1693
+ : ((rowTag = 0), (rowState = 3));
1694
+ continue;
1695
+ case 2:
1696
+ lastIdx = chunk[i++];
1697
+ 44 === lastIdx
1698
+ ? (rowState = 4)
1699
+ : (rowLength =
1700
+ (rowLength << 4) | (96 < lastIdx ? lastIdx - 87 : lastIdx - 48));
1701
+ continue;
1702
+ case 3:
1703
+ lastIdx = chunk.indexOf(10, i);
1704
+ break;
1705
+ case 4:
1706
+ (lastIdx = i + rowLength), lastIdx > chunk.length && (lastIdx = -1);
1707
+ }
1708
+ var offset = chunk.byteOffset + i;
1709
+ if (-1 < lastIdx)
1710
+ (rowLength = new Uint8Array(chunk.buffer, offset, lastIdx - i)),
1711
+ processFullBinaryRow(response, rowID, rowTag, buffer, rowLength),
1712
+ (i = lastIdx),
1713
+ 3 === rowState && i++,
1714
+ (rowLength = rowID = rowTag = rowState = 0),
1715
+ (buffer.length = 0);
1716
+ else {
1717
+ chunk = new Uint8Array(chunk.buffer, offset, chunk.byteLength - i);
1718
+ buffer.push(chunk);
1719
+ rowLength -= chunk.byteLength;
1720
+ break;
1721
+ }
1722
+ }
1723
+ response._rowState = rowState;
1724
+ response._rowID = rowID;
1725
+ response._rowTag = rowTag;
1726
+ response._rowLength = rowLength;
1727
+ }
1650
1728
  function createFromJSONCallback(response) {
1651
1729
  return function (key, value) {
1652
1730
  if ("string" === typeof value)
@@ -1687,11 +1765,60 @@ function createFromJSONCallback(response) {
1687
1765
  return value;
1688
1766
  };
1689
1767
  }
1768
+ function close(response) {
1769
+ reportGlobalError(response, Error("Connection closed."));
1770
+ }
1771
+ function noServerCall$1() {
1772
+ throw Error(
1773
+ "Server Functions cannot be called during initial render. This would create a fetch waterfall. Try to use a Server Component to pass data to Client Components instead."
1774
+ );
1775
+ }
1776
+ function createResponseFromOptions(options) {
1777
+ return new ResponseInstance(
1778
+ options.serverConsumerManifest.moduleMap,
1779
+ options.serverConsumerManifest.serverModuleMap,
1780
+ options.serverConsumerManifest.moduleLoading,
1781
+ noServerCall$1,
1782
+ options.encodeFormAction,
1783
+ "string" === typeof options.nonce ? options.nonce : void 0,
1784
+ options && options.temporaryReferences
1785
+ ? options.temporaryReferences
1786
+ : void 0
1787
+ );
1788
+ }
1789
+ function startReadingFromStream(response, stream) {
1790
+ function progress(_ref) {
1791
+ var value = _ref.value;
1792
+ if (_ref.done) close(response);
1793
+ else
1794
+ return (
1795
+ processBinaryChunk(response, value),
1796
+ reader.read().then(progress).catch(error)
1797
+ );
1798
+ }
1799
+ function error(e) {
1800
+ reportGlobalError(response, e);
1801
+ }
1802
+ var reader = stream.getReader();
1803
+ reader.read().then(progress).catch(error);
1804
+ }
1690
1805
  function noServerCall() {
1691
1806
  throw Error(
1692
1807
  "Server Functions cannot be called during initial render. This would create a fetch waterfall. Try to use a Server Component to pass data to Client Components instead."
1693
1808
  );
1694
1809
  }
1810
+ exports.createFromFetch = function (promiseForResponse, options) {
1811
+ var response = createResponseFromOptions(options);
1812
+ promiseForResponse.then(
1813
+ function (r) {
1814
+ startReadingFromStream(response, r.body);
1815
+ },
1816
+ function (e) {
1817
+ reportGlobalError(response, e);
1818
+ }
1819
+ );
1820
+ return getChunk(response, 0);
1821
+ };
1695
1822
  exports.createFromNodeStream = function (
1696
1823
  stream,
1697
1824
  serverConsumerManifest,
@@ -1793,101 +1920,50 @@ exports.createFromNodeStream = function (
1793
1920
  response._rowID = rowID;
1794
1921
  response._rowTag = rowTag;
1795
1922
  response._rowLength = rowLength;
1796
- } else {
1797
- rowLength = 0;
1798
- chunkLength = response._rowState;
1799
- rowID = response._rowID;
1800
- i = response._rowTag;
1801
- rowState = response._rowLength;
1802
- buffer = response._buffer;
1803
- for (rowTag = chunk.length; rowLength < rowTag; ) {
1804
- lastIdx = -1;
1805
- switch (chunkLength) {
1806
- case 0:
1807
- lastIdx = chunk[rowLength++];
1808
- 58 === lastIdx
1809
- ? (chunkLength = 1)
1810
- : (rowID =
1811
- (rowID << 4) | (96 < lastIdx ? lastIdx - 87 : lastIdx - 48));
1812
- continue;
1813
- case 1:
1814
- chunkLength = chunk[rowLength];
1815
- 84 === chunkLength ||
1816
- 65 === chunkLength ||
1817
- 79 === chunkLength ||
1818
- 111 === chunkLength ||
1819
- 85 === chunkLength ||
1820
- 83 === chunkLength ||
1821
- 115 === chunkLength ||
1822
- 76 === chunkLength ||
1823
- 108 === chunkLength ||
1824
- 71 === chunkLength ||
1825
- 103 === chunkLength ||
1826
- 77 === chunkLength ||
1827
- 109 === chunkLength ||
1828
- 86 === chunkLength
1829
- ? ((i = chunkLength), (chunkLength = 2), rowLength++)
1830
- : (64 < chunkLength && 91 > chunkLength) ||
1831
- 35 === chunkLength ||
1832
- 114 === chunkLength ||
1833
- 120 === chunkLength
1834
- ? ((i = chunkLength), (chunkLength = 3), rowLength++)
1835
- : ((i = 0), (chunkLength = 3));
1836
- continue;
1837
- case 2:
1838
- lastIdx = chunk[rowLength++];
1839
- 44 === lastIdx
1840
- ? (chunkLength = 4)
1841
- : (rowState =
1842
- (rowState << 4) |
1843
- (96 < lastIdx ? lastIdx - 87 : lastIdx - 48));
1844
- continue;
1845
- case 3:
1846
- lastIdx = chunk.indexOf(10, rowLength);
1847
- break;
1848
- case 4:
1849
- (lastIdx = rowLength + rowState),
1850
- lastIdx > chunk.length && (lastIdx = -1);
1851
- }
1852
- var offset = chunk.byteOffset + rowLength;
1853
- if (-1 < lastIdx)
1854
- (rowState = new Uint8Array(
1855
- chunk.buffer,
1856
- offset,
1857
- lastIdx - rowLength
1858
- )),
1859
- processFullBinaryRow(response, rowID, i, buffer, rowState),
1860
- (rowLength = lastIdx),
1861
- 3 === chunkLength && rowLength++,
1862
- (rowState = rowID = i = chunkLength = 0),
1863
- (buffer.length = 0);
1864
- else {
1865
- chunk = new Uint8Array(
1866
- chunk.buffer,
1867
- offset,
1868
- chunk.byteLength - rowLength
1869
- );
1870
- buffer.push(chunk);
1871
- rowState -= chunk.byteLength;
1872
- break;
1873
- }
1874
- }
1875
- response._rowState = chunkLength;
1876
- response._rowID = rowID;
1877
- response._rowTag = i;
1878
- response._rowLength = rowState;
1879
- }
1923
+ } else processBinaryChunk(response, chunk);
1880
1924
  });
1881
1925
  stream.on("error", function (error) {
1882
1926
  reportGlobalError(response, error);
1883
1927
  });
1884
1928
  stream.on("end", function () {
1885
- reportGlobalError(response, Error("Connection closed."));
1929
+ return close(response);
1886
1930
  });
1887
1931
  return getChunk(response, 0);
1888
1932
  };
1933
+ exports.createFromReadableStream = function (stream, options) {
1934
+ options = createResponseFromOptions(options);
1935
+ startReadingFromStream(options, stream);
1936
+ return getChunk(options, 0);
1937
+ };
1889
1938
  exports.createServerReference = function (id) {
1890
- return createServerReference$1(id, noServerCall);
1939
+ return createServerReference$1(id, noServerCall$1);
1940
+ };
1941
+ exports.createTemporaryReferenceSet = function () {
1942
+ return new Map();
1943
+ };
1944
+ exports.encodeReply = function (value, options) {
1945
+ return new Promise(function (resolve, reject) {
1946
+ var abort = processReply(
1947
+ value,
1948
+ "",
1949
+ options && options.temporaryReferences
1950
+ ? options.temporaryReferences
1951
+ : void 0,
1952
+ resolve,
1953
+ reject
1954
+ );
1955
+ if (options && options.signal) {
1956
+ var signal = options.signal;
1957
+ if (signal.aborted) abort(signal.reason);
1958
+ else {
1959
+ var listener = function () {
1960
+ abort(signal.reason);
1961
+ signal.removeEventListener("abort", listener);
1962
+ };
1963
+ signal.addEventListener("abort", listener);
1964
+ }
1965
+ }
1966
+ });
1891
1967
  };
1892
1968
  exports.registerServerReference = function (reference, id, encodeFormAction) {
1893
1969
  registerBoundServerReference(reference, id, null, encodeFormAction);
@@ -2555,6 +2555,85 @@
2555
2555
  resolveModel(response, id, row);
2556
2556
  }
2557
2557
  }
2558
+ function processBinaryChunk(response, chunk) {
2559
+ for (
2560
+ var i = 0,
2561
+ rowState = response._rowState,
2562
+ rowID = response._rowID,
2563
+ rowTag = response._rowTag,
2564
+ rowLength = response._rowLength,
2565
+ buffer = response._buffer,
2566
+ chunkLength = chunk.length;
2567
+ i < chunkLength;
2568
+
2569
+ ) {
2570
+ var lastIdx = -1;
2571
+ switch (rowState) {
2572
+ case 0:
2573
+ lastIdx = chunk[i++];
2574
+ 58 === lastIdx
2575
+ ? (rowState = 1)
2576
+ : (rowID =
2577
+ (rowID << 4) | (96 < lastIdx ? lastIdx - 87 : lastIdx - 48));
2578
+ continue;
2579
+ case 1:
2580
+ rowState = chunk[i];
2581
+ 84 === rowState ||
2582
+ 65 === rowState ||
2583
+ 79 === rowState ||
2584
+ 111 === rowState ||
2585
+ 85 === rowState ||
2586
+ 83 === rowState ||
2587
+ 115 === rowState ||
2588
+ 76 === rowState ||
2589
+ 108 === rowState ||
2590
+ 71 === rowState ||
2591
+ 103 === rowState ||
2592
+ 77 === rowState ||
2593
+ 109 === rowState ||
2594
+ 86 === rowState
2595
+ ? ((rowTag = rowState), (rowState = 2), i++)
2596
+ : (64 < rowState && 91 > rowState) ||
2597
+ 35 === rowState ||
2598
+ 114 === rowState ||
2599
+ 120 === rowState
2600
+ ? ((rowTag = rowState), (rowState = 3), i++)
2601
+ : ((rowTag = 0), (rowState = 3));
2602
+ continue;
2603
+ case 2:
2604
+ lastIdx = chunk[i++];
2605
+ 44 === lastIdx
2606
+ ? (rowState = 4)
2607
+ : (rowLength =
2608
+ (rowLength << 4) |
2609
+ (96 < lastIdx ? lastIdx - 87 : lastIdx - 48));
2610
+ continue;
2611
+ case 3:
2612
+ lastIdx = chunk.indexOf(10, i);
2613
+ break;
2614
+ case 4:
2615
+ (lastIdx = i + rowLength), lastIdx > chunk.length && (lastIdx = -1);
2616
+ }
2617
+ var offset = chunk.byteOffset + i;
2618
+ if (-1 < lastIdx)
2619
+ (rowLength = new Uint8Array(chunk.buffer, offset, lastIdx - i)),
2620
+ processFullBinaryRow(response, rowID, rowTag, buffer, rowLength),
2621
+ (i = lastIdx),
2622
+ 3 === rowState && i++,
2623
+ (rowLength = rowID = rowTag = rowState = 0),
2624
+ (buffer.length = 0);
2625
+ else {
2626
+ chunk = new Uint8Array(chunk.buffer, offset, chunk.byteLength - i);
2627
+ buffer.push(chunk);
2628
+ rowLength -= chunk.byteLength;
2629
+ break;
2630
+ }
2631
+ }
2632
+ response._rowState = rowState;
2633
+ response._rowID = rowID;
2634
+ response._rowTag = rowTag;
2635
+ response._rowLength = rowLength;
2636
+ }
2558
2637
  function createFromJSONCallback(response) {
2559
2638
  return function (key, value) {
2560
2639
  if ("string" === typeof value)
@@ -2665,6 +2744,46 @@
2665
2744
  return value;
2666
2745
  };
2667
2746
  }
2747
+ function close(response) {
2748
+ reportGlobalError(response, Error("Connection closed."));
2749
+ }
2750
+ function noServerCall$1() {
2751
+ throw Error(
2752
+ "Server Functions cannot be called during initial render. This would create a fetch waterfall. Try to use a Server Component to pass data to Client Components instead."
2753
+ );
2754
+ }
2755
+ function createResponseFromOptions(options) {
2756
+ return new ResponseInstance(
2757
+ options.serverConsumerManifest.moduleMap,
2758
+ options.serverConsumerManifest.serverModuleMap,
2759
+ options.serverConsumerManifest.moduleLoading,
2760
+ noServerCall$1,
2761
+ options.encodeFormAction,
2762
+ "string" === typeof options.nonce ? options.nonce : void 0,
2763
+ options && options.temporaryReferences
2764
+ ? options.temporaryReferences
2765
+ : void 0,
2766
+ options && options.findSourceMapURL ? options.findSourceMapURL : void 0,
2767
+ options ? !0 === options.replayConsoleLogs : !1,
2768
+ options && options.environmentName ? options.environmentName : void 0
2769
+ );
2770
+ }
2771
+ function startReadingFromStream(response, stream) {
2772
+ function progress(_ref) {
2773
+ var value = _ref.value;
2774
+ if (_ref.done) close(response);
2775
+ else
2776
+ return (
2777
+ processBinaryChunk(response, value),
2778
+ reader.read().then(progress).catch(error)
2779
+ );
2780
+ }
2781
+ function error(e) {
2782
+ reportGlobalError(response, e);
2783
+ }
2784
+ var reader = stream.getReader();
2785
+ reader.read().then(progress).catch(error);
2786
+ }
2668
2787
  function noServerCall() {
2669
2788
  throw Error(
2670
2789
  "Server Functions cannot be called during initial render. This would create a fetch waterfall. Try to use a Server Component to pass data to Client Components instead."
@@ -2844,6 +2963,18 @@
2844
2963
  replayConsoleWithCallStackInDEV = replayConsoleWithCallStack[
2845
2964
  "react-stack-bottom-frame"
2846
2965
  ].bind(replayConsoleWithCallStack);
2966
+ exports.createFromFetch = function (promiseForResponse, options) {
2967
+ var response = createResponseFromOptions(options);
2968
+ promiseForResponse.then(
2969
+ function (r) {
2970
+ startReadingFromStream(response, r.body);
2971
+ },
2972
+ function (e) {
2973
+ reportGlobalError(response, e);
2974
+ }
2975
+ );
2976
+ return getChunk(response, 0);
2977
+ };
2847
2978
  exports.createFromNodeStream = function (
2848
2979
  stream,
2849
2980
  serverConsumerManifest,
@@ -2949,102 +3080,50 @@
2949
3080
  response._rowID = rowID;
2950
3081
  response._rowTag = rowTag;
2951
3082
  response._rowLength = rowLength;
2952
- } else {
2953
- rowLength = 0;
2954
- chunkLength = response._rowState;
2955
- rowID = response._rowID;
2956
- i = response._rowTag;
2957
- rowState = response._rowLength;
2958
- buffer = response._buffer;
2959
- for (rowTag = chunk.length; rowLength < rowTag; ) {
2960
- lastIdx = -1;
2961
- switch (chunkLength) {
2962
- case 0:
2963
- lastIdx = chunk[rowLength++];
2964
- 58 === lastIdx
2965
- ? (chunkLength = 1)
2966
- : (rowID =
2967
- (rowID << 4) |
2968
- (96 < lastIdx ? lastIdx - 87 : lastIdx - 48));
2969
- continue;
2970
- case 1:
2971
- chunkLength = chunk[rowLength];
2972
- 84 === chunkLength ||
2973
- 65 === chunkLength ||
2974
- 79 === chunkLength ||
2975
- 111 === chunkLength ||
2976
- 85 === chunkLength ||
2977
- 83 === chunkLength ||
2978
- 115 === chunkLength ||
2979
- 76 === chunkLength ||
2980
- 108 === chunkLength ||
2981
- 71 === chunkLength ||
2982
- 103 === chunkLength ||
2983
- 77 === chunkLength ||
2984
- 109 === chunkLength ||
2985
- 86 === chunkLength
2986
- ? ((i = chunkLength), (chunkLength = 2), rowLength++)
2987
- : (64 < chunkLength && 91 > chunkLength) ||
2988
- 35 === chunkLength ||
2989
- 114 === chunkLength ||
2990
- 120 === chunkLength
2991
- ? ((i = chunkLength), (chunkLength = 3), rowLength++)
2992
- : ((i = 0), (chunkLength = 3));
2993
- continue;
2994
- case 2:
2995
- lastIdx = chunk[rowLength++];
2996
- 44 === lastIdx
2997
- ? (chunkLength = 4)
2998
- : (rowState =
2999
- (rowState << 4) |
3000
- (96 < lastIdx ? lastIdx - 87 : lastIdx - 48));
3001
- continue;
3002
- case 3:
3003
- lastIdx = chunk.indexOf(10, rowLength);
3004
- break;
3005
- case 4:
3006
- (lastIdx = rowLength + rowState),
3007
- lastIdx > chunk.length && (lastIdx = -1);
3008
- }
3009
- var offset = chunk.byteOffset + rowLength;
3010
- if (-1 < lastIdx)
3011
- (rowState = new Uint8Array(
3012
- chunk.buffer,
3013
- offset,
3014
- lastIdx - rowLength
3015
- )),
3016
- processFullBinaryRow(response, rowID, i, buffer, rowState),
3017
- (rowLength = lastIdx),
3018
- 3 === chunkLength && rowLength++,
3019
- (rowState = rowID = i = chunkLength = 0),
3020
- (buffer.length = 0);
3021
- else {
3022
- chunk = new Uint8Array(
3023
- chunk.buffer,
3024
- offset,
3025
- chunk.byteLength - rowLength
3026
- );
3027
- buffer.push(chunk);
3028
- rowState -= chunk.byteLength;
3029
- break;
3030
- }
3031
- }
3032
- response._rowState = chunkLength;
3033
- response._rowID = rowID;
3034
- response._rowTag = i;
3035
- response._rowLength = rowState;
3036
- }
3083
+ } else processBinaryChunk(response, chunk);
3037
3084
  });
3038
3085
  stream.on("error", function (error) {
3039
3086
  reportGlobalError(response, error);
3040
3087
  });
3041
3088
  stream.on("end", function () {
3042
- reportGlobalError(response, Error("Connection closed."));
3089
+ return close(response);
3043
3090
  });
3044
3091
  return getChunk(response, 0);
3045
3092
  };
3093
+ exports.createFromReadableStream = function (stream, options) {
3094
+ options = createResponseFromOptions(options);
3095
+ startReadingFromStream(options, stream);
3096
+ return getChunk(options, 0);
3097
+ };
3046
3098
  exports.createServerReference = function (id) {
3047
- return createServerReference$1(id, noServerCall);
3099
+ return createServerReference$1(id, noServerCall$1);
3100
+ };
3101
+ exports.createTemporaryReferenceSet = function () {
3102
+ return new Map();
3103
+ };
3104
+ exports.encodeReply = function (value, options) {
3105
+ return new Promise(function (resolve, reject) {
3106
+ var abort = processReply(
3107
+ value,
3108
+ "",
3109
+ options && options.temporaryReferences
3110
+ ? options.temporaryReferences
3111
+ : void 0,
3112
+ resolve,
3113
+ reject
3114
+ );
3115
+ if (options && options.signal) {
3116
+ var signal = options.signal;
3117
+ if (signal.aborted) abort(signal.reason);
3118
+ else {
3119
+ var listener = function () {
3120
+ abort(signal.reason);
3121
+ signal.removeEventListener("abort", listener);
3122
+ };
3123
+ signal.addEventListener("abort", listener);
3124
+ }
3125
+ }
3126
+ });
3048
3127
  };
3049
3128
  exports.registerServerReference = function (
3050
3129
  reference,
@@ -1612,6 +1612,84 @@ function processFullStringRow(response, id, tag, row) {
1612
1612
  );
1613
1613
  }
1614
1614
  }
1615
+ function processBinaryChunk(response, chunk) {
1616
+ for (
1617
+ var i = 0,
1618
+ rowState = response._rowState,
1619
+ rowID = response._rowID,
1620
+ rowTag = response._rowTag,
1621
+ rowLength = response._rowLength,
1622
+ buffer = response._buffer,
1623
+ chunkLength = chunk.length;
1624
+ i < chunkLength;
1625
+
1626
+ ) {
1627
+ var lastIdx = -1;
1628
+ switch (rowState) {
1629
+ case 0:
1630
+ lastIdx = chunk[i++];
1631
+ 58 === lastIdx
1632
+ ? (rowState = 1)
1633
+ : (rowID =
1634
+ (rowID << 4) | (96 < lastIdx ? lastIdx - 87 : lastIdx - 48));
1635
+ continue;
1636
+ case 1:
1637
+ rowState = chunk[i];
1638
+ 84 === rowState ||
1639
+ 65 === rowState ||
1640
+ 79 === rowState ||
1641
+ 111 === rowState ||
1642
+ 85 === rowState ||
1643
+ 83 === rowState ||
1644
+ 115 === rowState ||
1645
+ 76 === rowState ||
1646
+ 108 === rowState ||
1647
+ 71 === rowState ||
1648
+ 103 === rowState ||
1649
+ 77 === rowState ||
1650
+ 109 === rowState ||
1651
+ 86 === rowState
1652
+ ? ((rowTag = rowState), (rowState = 2), i++)
1653
+ : (64 < rowState && 91 > rowState) ||
1654
+ 35 === rowState ||
1655
+ 114 === rowState ||
1656
+ 120 === rowState
1657
+ ? ((rowTag = rowState), (rowState = 3), i++)
1658
+ : ((rowTag = 0), (rowState = 3));
1659
+ continue;
1660
+ case 2:
1661
+ lastIdx = chunk[i++];
1662
+ 44 === lastIdx
1663
+ ? (rowState = 4)
1664
+ : (rowLength =
1665
+ (rowLength << 4) | (96 < lastIdx ? lastIdx - 87 : lastIdx - 48));
1666
+ continue;
1667
+ case 3:
1668
+ lastIdx = chunk.indexOf(10, i);
1669
+ break;
1670
+ case 4:
1671
+ (lastIdx = i + rowLength), lastIdx > chunk.length && (lastIdx = -1);
1672
+ }
1673
+ var offset = chunk.byteOffset + i;
1674
+ if (-1 < lastIdx)
1675
+ (rowLength = new Uint8Array(chunk.buffer, offset, lastIdx - i)),
1676
+ processFullBinaryRow(response, rowID, rowTag, buffer, rowLength),
1677
+ (i = lastIdx),
1678
+ 3 === rowState && i++,
1679
+ (rowLength = rowID = rowTag = rowState = 0),
1680
+ (buffer.length = 0);
1681
+ else {
1682
+ chunk = new Uint8Array(chunk.buffer, offset, chunk.byteLength - i);
1683
+ buffer.push(chunk);
1684
+ rowLength -= chunk.byteLength;
1685
+ break;
1686
+ }
1687
+ }
1688
+ response._rowState = rowState;
1689
+ response._rowID = rowID;
1690
+ response._rowTag = rowTag;
1691
+ response._rowLength = rowLength;
1692
+ }
1615
1693
  function createFromJSONCallback(response) {
1616
1694
  return function (key, value) {
1617
1695
  if ("string" === typeof value)
@@ -1652,11 +1730,60 @@ function createFromJSONCallback(response) {
1652
1730
  return value;
1653
1731
  };
1654
1732
  }
1733
+ function close(response) {
1734
+ reportGlobalError(response, Error("Connection closed."));
1735
+ }
1736
+ function noServerCall$1() {
1737
+ throw Error(
1738
+ "Server Functions cannot be called during initial render. This would create a fetch waterfall. Try to use a Server Component to pass data to Client Components instead."
1739
+ );
1740
+ }
1741
+ function createResponseFromOptions(options) {
1742
+ return new ResponseInstance(
1743
+ options.serverConsumerManifest.moduleMap,
1744
+ options.serverConsumerManifest.serverModuleMap,
1745
+ options.serverConsumerManifest.moduleLoading,
1746
+ noServerCall$1,
1747
+ options.encodeFormAction,
1748
+ "string" === typeof options.nonce ? options.nonce : void 0,
1749
+ options && options.temporaryReferences
1750
+ ? options.temporaryReferences
1751
+ : void 0
1752
+ );
1753
+ }
1754
+ function startReadingFromStream(response, stream) {
1755
+ function progress(_ref) {
1756
+ var value = _ref.value;
1757
+ if (_ref.done) close(response);
1758
+ else
1759
+ return (
1760
+ processBinaryChunk(response, value),
1761
+ reader.read().then(progress).catch(error)
1762
+ );
1763
+ }
1764
+ function error(e) {
1765
+ reportGlobalError(response, e);
1766
+ }
1767
+ var reader = stream.getReader();
1768
+ reader.read().then(progress).catch(error);
1769
+ }
1655
1770
  function noServerCall() {
1656
1771
  throw Error(
1657
1772
  "Server Functions cannot be called during initial render. This would create a fetch waterfall. Try to use a Server Component to pass data to Client Components instead."
1658
1773
  );
1659
1774
  }
1775
+ exports.createFromFetch = function (promiseForResponse, options) {
1776
+ var response = createResponseFromOptions(options);
1777
+ promiseForResponse.then(
1778
+ function (r) {
1779
+ startReadingFromStream(response, r.body);
1780
+ },
1781
+ function (e) {
1782
+ reportGlobalError(response, e);
1783
+ }
1784
+ );
1785
+ return getChunk(response, 0);
1786
+ };
1660
1787
  exports.createFromNodeStream = function (
1661
1788
  stream,
1662
1789
  serverConsumerManifest,
@@ -1758,101 +1885,50 @@ exports.createFromNodeStream = function (
1758
1885
  response._rowID = rowID;
1759
1886
  response._rowTag = rowTag;
1760
1887
  response._rowLength = rowLength;
1761
- } else {
1762
- rowLength = 0;
1763
- chunkLength = response._rowState;
1764
- rowID = response._rowID;
1765
- i = response._rowTag;
1766
- rowState = response._rowLength;
1767
- buffer = response._buffer;
1768
- for (rowTag = chunk.length; rowLength < rowTag; ) {
1769
- lastIdx = -1;
1770
- switch (chunkLength) {
1771
- case 0:
1772
- lastIdx = chunk[rowLength++];
1773
- 58 === lastIdx
1774
- ? (chunkLength = 1)
1775
- : (rowID =
1776
- (rowID << 4) | (96 < lastIdx ? lastIdx - 87 : lastIdx - 48));
1777
- continue;
1778
- case 1:
1779
- chunkLength = chunk[rowLength];
1780
- 84 === chunkLength ||
1781
- 65 === chunkLength ||
1782
- 79 === chunkLength ||
1783
- 111 === chunkLength ||
1784
- 85 === chunkLength ||
1785
- 83 === chunkLength ||
1786
- 115 === chunkLength ||
1787
- 76 === chunkLength ||
1788
- 108 === chunkLength ||
1789
- 71 === chunkLength ||
1790
- 103 === chunkLength ||
1791
- 77 === chunkLength ||
1792
- 109 === chunkLength ||
1793
- 86 === chunkLength
1794
- ? ((i = chunkLength), (chunkLength = 2), rowLength++)
1795
- : (64 < chunkLength && 91 > chunkLength) ||
1796
- 35 === chunkLength ||
1797
- 114 === chunkLength ||
1798
- 120 === chunkLength
1799
- ? ((i = chunkLength), (chunkLength = 3), rowLength++)
1800
- : ((i = 0), (chunkLength = 3));
1801
- continue;
1802
- case 2:
1803
- lastIdx = chunk[rowLength++];
1804
- 44 === lastIdx
1805
- ? (chunkLength = 4)
1806
- : (rowState =
1807
- (rowState << 4) |
1808
- (96 < lastIdx ? lastIdx - 87 : lastIdx - 48));
1809
- continue;
1810
- case 3:
1811
- lastIdx = chunk.indexOf(10, rowLength);
1812
- break;
1813
- case 4:
1814
- (lastIdx = rowLength + rowState),
1815
- lastIdx > chunk.length && (lastIdx = -1);
1816
- }
1817
- var offset = chunk.byteOffset + rowLength;
1818
- if (-1 < lastIdx)
1819
- (rowState = new Uint8Array(
1820
- chunk.buffer,
1821
- offset,
1822
- lastIdx - rowLength
1823
- )),
1824
- processFullBinaryRow(response, rowID, i, buffer, rowState),
1825
- (rowLength = lastIdx),
1826
- 3 === chunkLength && rowLength++,
1827
- (rowState = rowID = i = chunkLength = 0),
1828
- (buffer.length = 0);
1829
- else {
1830
- chunk = new Uint8Array(
1831
- chunk.buffer,
1832
- offset,
1833
- chunk.byteLength - rowLength
1834
- );
1835
- buffer.push(chunk);
1836
- rowState -= chunk.byteLength;
1837
- break;
1838
- }
1839
- }
1840
- response._rowState = chunkLength;
1841
- response._rowID = rowID;
1842
- response._rowTag = i;
1843
- response._rowLength = rowState;
1844
- }
1888
+ } else processBinaryChunk(response, chunk);
1845
1889
  });
1846
1890
  stream.on("error", function (error) {
1847
1891
  reportGlobalError(response, error);
1848
1892
  });
1849
1893
  stream.on("end", function () {
1850
- reportGlobalError(response, Error("Connection closed."));
1894
+ return close(response);
1851
1895
  });
1852
1896
  return getChunk(response, 0);
1853
1897
  };
1898
+ exports.createFromReadableStream = function (stream, options) {
1899
+ options = createResponseFromOptions(options);
1900
+ startReadingFromStream(options, stream);
1901
+ return getChunk(options, 0);
1902
+ };
1854
1903
  exports.createServerReference = function (id) {
1855
- return createServerReference$1(id, noServerCall);
1904
+ return createServerReference$1(id, noServerCall$1);
1905
+ };
1906
+ exports.createTemporaryReferenceSet = function () {
1907
+ return new Map();
1908
+ };
1909
+ exports.encodeReply = function (value, options) {
1910
+ return new Promise(function (resolve, reject) {
1911
+ var abort = processReply(
1912
+ value,
1913
+ "",
1914
+ options && options.temporaryReferences
1915
+ ? options.temporaryReferences
1916
+ : void 0,
1917
+ resolve,
1918
+ reject
1919
+ );
1920
+ if (options && options.signal) {
1921
+ var signal = options.signal;
1922
+ if (signal.aborted) abort(signal.reason);
1923
+ else {
1924
+ var listener = function () {
1925
+ abort(signal.reason);
1926
+ signal.removeEventListener("abort", listener);
1927
+ };
1928
+ signal.addEventListener("abort", listener);
1929
+ }
1930
+ }
1931
+ });
1856
1932
  };
1857
1933
  exports.registerServerReference = function (reference, id, encodeFormAction) {
1858
1934
  registerBoundServerReference(reference, id, null, encodeFormAction);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "react-server-dom-webpack",
3
3
  "description": "React Server Components bindings for DOM using Webpack. This is intended to be integrated into meta-frameworks. It is not intended to be imported directly.",
4
- "version": "19.2.0-canary-b4477d38-20250605",
4
+ "version": "19.2.0-canary-280ff6fe-20250606",
5
5
  "keywords": [
6
6
  "react"
7
7
  ],
@@ -99,8 +99,8 @@
99
99
  "node": ">=0.10.0"
100
100
  },
101
101
  "peerDependencies": {
102
- "react": "19.2.0-canary-b4477d38-20250605",
103
- "react-dom": "19.2.0-canary-b4477d38-20250605",
102
+ "react": "19.2.0-canary-280ff6fe-20250606",
103
+ "react-dom": "19.2.0-canary-280ff6fe-20250606",
104
104
  "webpack": "^5.59.0"
105
105
  },
106
106
  "dependencies": {