react-server-dom-webpack 19.0.0-beta-e7d213dfb0-20240507 → 19.0.0-beta-6946ebe620-20240508

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.
@@ -1983,9 +1983,8 @@ function renderFragment(request, task, children) {
1983
1983
 
1984
1984
  function renderClientElement(task, type, key, props, owner) // DEV-only
1985
1985
  {
1986
+ // We prepend the terminal client element that actually gets serialized with
1986
1987
  // the keys of any Server Components which are not serialized.
1987
-
1988
-
1989
1988
  var keyPath = task.keyPath;
1990
1989
 
1991
1990
  if (key === null) {
@@ -2129,7 +2128,7 @@ function createTask(request, model, keyPath, implicitSlot, abortSet) {
2129
2128
  if (typeof model === 'object' && model !== null) {
2130
2129
  // If we're about to write this into a new task we can assign it an ID early so that
2131
2130
  // any other references can refer to the value we're about to write.
2132
- if ((keyPath !== null || implicitSlot)) ; else {
2131
+ if (keyPath !== null || implicitSlot) ; else {
2133
2132
  request.writtenObjects.set(model, id);
2134
2133
  }
2135
2134
  }
@@ -2471,7 +2470,7 @@ function renderModelDestructive(request, task, parent, parentPropertyName, value
2471
2470
  var _existingId = _writtenObjects.get(value);
2472
2471
 
2473
2472
  if (_existingId !== undefined) {
2474
- if ((task.keyPath !== null || task.implicitSlot)) ; else if (modelRoot === value) {
2473
+ if (task.keyPath !== null || task.implicitSlot) ; else if (modelRoot === value) {
2475
2474
  // This is the ID we're currently emitting so we need to write it
2476
2475
  // once but if we discover it again, we refer to it by id.
2477
2476
  modelRoot = null;
@@ -2576,7 +2575,7 @@ function renderModelDestructive(request, task, parent, parentPropertyName, value
2576
2575
 
2577
2576
  if (typeof value.then === 'function') {
2578
2577
  if (existingId !== undefined) {
2579
- if ((task.keyPath !== null || task.implicitSlot)) {
2578
+ if (task.keyPath !== null || task.implicitSlot) {
2580
2579
  // If we're in some kind of context we can't reuse the result of this render or
2581
2580
  // previous renders of this element. We only reuse Promises if they're not wrapped
2582
2581
  // by another Server Component.
@@ -3696,7 +3695,7 @@ function loadServerReference$1(response, id, bound, parentChunk, parentObject, k
3696
3695
  }
3697
3696
  }
3698
3697
 
3699
- promise.then(createModelResolver(parentChunk, parentObject, key), createModelReject(parentChunk)); // We need a placeholder value that will be replaced later.
3698
+ promise.then(createModelResolver(parentChunk, parentObject, key, false, response, createModel), createModelReject(parentChunk)); // We need a placeholder value that will be replaced later.
3700
3699
 
3701
3700
  return null;
3702
3701
  }
@@ -3773,21 +3772,24 @@ function getChunk(response, id) {
3773
3772
  return chunk;
3774
3773
  }
3775
3774
 
3776
- function createModelResolver(chunk, parentObject, key) {
3775
+ function createModelResolver(chunk, parentObject, key, cyclic, response, map) {
3777
3776
  var blocked;
3778
3777
 
3779
3778
  if (initializingChunkBlockedModel) {
3780
3779
  blocked = initializingChunkBlockedModel;
3781
- blocked.deps++;
3780
+
3781
+ if (!cyclic) {
3782
+ blocked.deps++;
3783
+ }
3782
3784
  } else {
3783
3785
  blocked = initializingChunkBlockedModel = {
3784
- deps: 1,
3786
+ deps: cyclic ? 0 : 1,
3785
3787
  value: null
3786
3788
  };
3787
3789
  }
3788
3790
 
3789
3791
  return function (value) {
3790
- parentObject[key] = value; // If this is the root object for a model reference, where `blocked.value`
3792
+ parentObject[key] = map(response, value); // If this is the root object for a model reference, where `blocked.value`
3791
3793
  // is a stale `null`, the resolved value can be used directly.
3792
3794
 
3793
3795
  if (key === '' && blocked.value === null) {
@@ -3819,19 +3821,46 @@ function createModelReject(chunk) {
3819
3821
  };
3820
3822
  }
3821
3823
 
3822
- function getOutlinedModel(response, id) {
3824
+ function getOutlinedModel(response, id, parentObject, key, map) {
3823
3825
  var chunk = getChunk(response, id);
3824
3826
 
3825
- if (chunk.status === RESOLVED_MODEL) {
3826
- initializeModelChunk(chunk);
3827
- }
3827
+ switch (chunk.status) {
3828
+ case RESOLVED_MODEL:
3829
+ initializeModelChunk(chunk);
3830
+ break;
3831
+ } // The status might have changed after initialization.
3828
3832
 
3829
- if (chunk.status !== INITIALIZED) {
3830
- // We know that this is emitted earlier so otherwise it's an error.
3831
- throw chunk.reason;
3833
+
3834
+ switch (chunk.status) {
3835
+ case INITIALIZED:
3836
+ return map(response, chunk.value);
3837
+
3838
+ case PENDING:
3839
+ case BLOCKED:
3840
+ var parentChunk = initializingChunk;
3841
+ chunk.then(createModelResolver(parentChunk, parentObject, key, false, response, map), createModelReject(parentChunk));
3842
+ return null;
3843
+
3844
+ default:
3845
+ throw chunk.reason;
3832
3846
  }
3847
+ }
3848
+
3849
+ function createMap(response, model) {
3850
+ return new Map(model);
3851
+ }
3852
+
3853
+ function createSet(response, model) {
3854
+ return new Set(model);
3855
+ }
3833
3856
 
3834
- return chunk.value;
3857
+ function extractIterator(response, model) {
3858
+ // $FlowFixMe[incompatible-use]: This uses raw Symbols because we're extracting from a native array.
3859
+ return model[Symbol.iterator]();
3860
+ }
3861
+
3862
+ function createModel(response, model) {
3863
+ return model;
3835
3864
  }
3836
3865
 
3837
3866
  function parseModelString(response, obj, key, value) {
@@ -3848,9 +3877,8 @@ function parseModelString(response, obj, key, value) {
3848
3877
  // Promise
3849
3878
  var _id = parseInt(value.slice(2), 16);
3850
3879
 
3851
- var _chunk2 = getChunk(response, _id);
3852
-
3853
- return _chunk2;
3880
+ var chunk = getChunk(response, _id);
3881
+ return chunk;
3854
3882
  }
3855
3883
 
3856
3884
  case 'F':
@@ -3859,7 +3887,7 @@ function parseModelString(response, obj, key, value) {
3859
3887
  var _id2 = parseInt(value.slice(2), 16); // TODO: Just encode this in the reference inline instead of as a model.
3860
3888
 
3861
3889
 
3862
- var metaData = getOutlinedModel(response, _id2);
3890
+ var metaData = getOutlinedModel(response, _id2, obj, key, createModel);
3863
3891
  return loadServerReference$1(response, metaData.id, metaData.bound, initializingChunk, obj, key);
3864
3892
  }
3865
3893
 
@@ -3874,8 +3902,7 @@ function parseModelString(response, obj, key, value) {
3874
3902
  // Map
3875
3903
  var _id3 = parseInt(value.slice(2), 16);
3876
3904
 
3877
- var data = getOutlinedModel(response, _id3);
3878
- return new Map(data);
3905
+ return getOutlinedModel(response, _id3, obj, key, createMap);
3879
3906
  }
3880
3907
 
3881
3908
  case 'W':
@@ -3883,9 +3910,7 @@ function parseModelString(response, obj, key, value) {
3883
3910
  // Set
3884
3911
  var _id4 = parseInt(value.slice(2), 16);
3885
3912
 
3886
- var _data = getOutlinedModel(response, _id4);
3887
-
3888
- return new Set(_data);
3913
+ return getOutlinedModel(response, _id4, obj, key, createSet);
3889
3914
  }
3890
3915
 
3891
3916
  case 'K':
@@ -3893,9 +3918,7 @@ function parseModelString(response, obj, key, value) {
3893
3918
  // FormData
3894
3919
  var stringId = value.slice(2);
3895
3920
  var formPrefix = response._prefix + stringId + '_';
3896
-
3897
- var _data2 = new FormData();
3898
-
3921
+ var data = new FormData();
3899
3922
  var backingFormData = response._formData; // We assume that the reference to FormData always comes after each
3900
3923
  // entry that it references so we can assume they all exist in the
3901
3924
  // backing store already.
@@ -3903,10 +3926,10 @@ function parseModelString(response, obj, key, value) {
3903
3926
 
3904
3927
  backingFormData.forEach(function (entry, entryKey) {
3905
3928
  if (entryKey.startsWith(formPrefix)) {
3906
- _data2.append(entryKey.slice(formPrefix.length), entry);
3929
+ data.append(entryKey.slice(formPrefix.length), entry);
3907
3930
  }
3908
3931
  });
3909
- return _data2;
3932
+ return data;
3910
3933
  }
3911
3934
 
3912
3935
  case 'i':
@@ -3914,9 +3937,7 @@ function parseModelString(response, obj, key, value) {
3914
3937
  // Iterator
3915
3938
  var _id5 = parseInt(value.slice(2), 16);
3916
3939
 
3917
- var _data3 = getOutlinedModel(response, _id5);
3918
-
3919
- return _data3[Symbol.iterator]();
3940
+ return getOutlinedModel(response, _id5, obj, key, extractIterator);
3920
3941
  }
3921
3942
 
3922
3943
  case 'I':
@@ -3963,28 +3984,7 @@ function parseModelString(response, obj, key, value) {
3963
3984
 
3964
3985
 
3965
3986
  var id = parseInt(value.slice(1), 16);
3966
- var chunk = getChunk(response, id);
3967
-
3968
- switch (chunk.status) {
3969
- case RESOLVED_MODEL:
3970
- initializeModelChunk(chunk);
3971
- break;
3972
- } // The status might have changed after initialization.
3973
-
3974
-
3975
- switch (chunk.status) {
3976
- case INITIALIZED:
3977
- return chunk.value;
3978
-
3979
- case PENDING:
3980
- case BLOCKED:
3981
- var parentChunk = initializingChunk;
3982
- chunk.then(createModelResolver(parentChunk, obj, key), createModelReject(parentChunk));
3983
- return null;
3984
-
3985
- default:
3986
- throw chunk.reason;
3987
- }
3987
+ return getOutlinedModel(response, id, obj, key, createModel);
3988
3988
  }
3989
3989
 
3990
3990
  return value;
@@ -1641,20 +1641,27 @@ function loadServerReference$1(
1641
1641
  key
1642
1642
  ) {
1643
1643
  var serverReference = resolveServerReference(response._bundlerConfig, id);
1644
- response = preloadModule(serverReference);
1644
+ id = preloadModule(serverReference);
1645
1645
  if (bound)
1646
- bound = Promise.all([bound, response]).then(function (_ref) {
1646
+ bound = Promise.all([bound, id]).then(function (_ref) {
1647
1647
  _ref = _ref[0];
1648
1648
  var fn = requireModule(serverReference);
1649
1649
  return fn.bind.apply(fn, [null].concat(_ref));
1650
1650
  });
1651
- else if (response)
1652
- bound = Promise.resolve(response).then(function () {
1651
+ else if (id)
1652
+ bound = Promise.resolve(id).then(function () {
1653
1653
  return requireModule(serverReference);
1654
1654
  });
1655
1655
  else return requireModule(serverReference);
1656
1656
  bound.then(
1657
- createModelResolver(parentChunk, parentObject, key),
1657
+ createModelResolver(
1658
+ parentChunk,
1659
+ parentObject,
1660
+ key,
1661
+ !1,
1662
+ response,
1663
+ createModel
1664
+ ),
1658
1665
  createModelReject(parentChunk)
1659
1666
  );
1660
1667
  return null;
@@ -1699,13 +1706,17 @@ function getChunk(response, id) {
1699
1706
  chunks.set(id, chunk));
1700
1707
  return chunk;
1701
1708
  }
1702
- function createModelResolver(chunk, parentObject, key) {
1709
+ function createModelResolver(chunk, parentObject, key, cyclic, response, map) {
1703
1710
  if (initializingChunkBlockedModel) {
1704
1711
  var blocked = initializingChunkBlockedModel;
1705
- blocked.deps++;
1706
- } else blocked = initializingChunkBlockedModel = { deps: 1, value: null };
1712
+ cyclic || blocked.deps++;
1713
+ } else
1714
+ blocked = initializingChunkBlockedModel = {
1715
+ deps: cyclic ? 0 : 1,
1716
+ value: null
1717
+ };
1707
1718
  return function (value) {
1708
- parentObject[key] = value;
1719
+ parentObject[key] = map(response, value);
1709
1720
  "" === key && null === blocked.value && (blocked.value = parentObject[key]);
1710
1721
  blocked.deps--;
1711
1722
  0 === blocked.deps &&
@@ -1721,11 +1732,38 @@ function createModelReject(chunk) {
1721
1732
  return triggerErrorOnChunk(chunk, error);
1722
1733
  };
1723
1734
  }
1724
- function getOutlinedModel(response, id) {
1725
- response = getChunk(response, id);
1726
- "resolved_model" === response.status && initializeModelChunk(response);
1727
- if ("fulfilled" !== response.status) throw response.reason;
1728
- return response.value;
1735
+ function getOutlinedModel(response, id, parentObject, key, map) {
1736
+ id = getChunk(response, id);
1737
+ switch (id.status) {
1738
+ case "resolved_model":
1739
+ initializeModelChunk(id);
1740
+ }
1741
+ switch (id.status) {
1742
+ case "fulfilled":
1743
+ return map(response, id.value);
1744
+ case "pending":
1745
+ case "blocked":
1746
+ var parentChunk = initializingChunk;
1747
+ id.then(
1748
+ createModelResolver(parentChunk, parentObject, key, !1, response, map),
1749
+ createModelReject(parentChunk)
1750
+ );
1751
+ return null;
1752
+ default:
1753
+ throw id.reason;
1754
+ }
1755
+ }
1756
+ function createMap(response, model) {
1757
+ return new Map(model);
1758
+ }
1759
+ function createSet(response, model) {
1760
+ return new Set(model);
1761
+ }
1762
+ function extractIterator(response, model) {
1763
+ return model[Symbol.iterator]();
1764
+ }
1765
+ function createModel(response, model) {
1766
+ return model;
1729
1767
  }
1730
1768
  function parseModelString(response, obj, key, value) {
1731
1769
  if ("$" === value[0]) {
@@ -1737,7 +1775,7 @@ function parseModelString(response, obj, key, value) {
1737
1775
  case "F":
1738
1776
  return (
1739
1777
  (value = parseInt(value.slice(2), 16)),
1740
- (value = getOutlinedModel(response, value)),
1778
+ (value = getOutlinedModel(response, value, obj, key, createModel)),
1741
1779
  loadServerReference$1(
1742
1780
  response,
1743
1781
  value.id,
@@ -1751,29 +1789,27 @@ function parseModelString(response, obj, key, value) {
1751
1789
  return createTemporaryReference(value.slice(2));
1752
1790
  case "Q":
1753
1791
  return (
1754
- (obj = parseInt(value.slice(2), 16)),
1755
- (response = getOutlinedModel(response, obj)),
1756
- new Map(response)
1792
+ (value = parseInt(value.slice(2), 16)),
1793
+ getOutlinedModel(response, value, obj, key, createMap)
1757
1794
  );
1758
1795
  case "W":
1759
1796
  return (
1760
- (obj = parseInt(value.slice(2), 16)),
1761
- (response = getOutlinedModel(response, obj)),
1762
- new Set(response)
1797
+ (value = parseInt(value.slice(2), 16)),
1798
+ getOutlinedModel(response, value, obj, key, createSet)
1763
1799
  );
1764
1800
  case "K":
1765
1801
  obj = value.slice(2);
1766
1802
  var formPrefix = response._prefix + obj + "_",
1767
- data$23 = new FormData();
1803
+ data = new FormData();
1768
1804
  response._formData.forEach(function (entry, entryKey) {
1769
1805
  entryKey.startsWith(formPrefix) &&
1770
- data$23.append(entryKey.slice(formPrefix.length), entry);
1806
+ data.append(entryKey.slice(formPrefix.length), entry);
1771
1807
  });
1772
- return data$23;
1808
+ return data;
1773
1809
  case "i":
1774
1810
  return (
1775
- (obj = parseInt(value.slice(2), 16)),
1776
- getOutlinedModel(response, obj)[Symbol.iterator]()
1811
+ (value = parseInt(value.slice(2), 16)),
1812
+ getOutlinedModel(response, value, obj, key, extractIterator)
1777
1813
  );
1778
1814
  case "I":
1779
1815
  return Infinity;
@@ -1789,27 +1825,7 @@ function parseModelString(response, obj, key, value) {
1789
1825
  return BigInt(value.slice(2));
1790
1826
  }
1791
1827
  value = parseInt(value.slice(1), 16);
1792
- response = getChunk(response, value);
1793
- switch (response.status) {
1794
- case "resolved_model":
1795
- initializeModelChunk(response);
1796
- }
1797
- switch (response.status) {
1798
- case "fulfilled":
1799
- return response.value;
1800
- case "pending":
1801
- case "blocked":
1802
- return (
1803
- (value = initializingChunk),
1804
- response.then(
1805
- createModelResolver(value, obj, key),
1806
- createModelReject(value)
1807
- ),
1808
- null
1809
- );
1810
- default:
1811
- throw response.reason;
1812
- }
1828
+ return getOutlinedModel(response, value, obj, key, createModel);
1813
1829
  }
1814
1830
  return value;
1815
1831
  }
@@ -1966,12 +1982,12 @@ exports.decodeReplyFromBusboy = function (busboyStream, webpackMap) {
1966
1982
  "React doesn't accept base64 encoded file uploads because we don't expect form data passed from a browser to ever encode data that way. If that's the wrong assumption, we can easily fix it."
1967
1983
  );
1968
1984
  pendingFiles++;
1969
- var JSCompiler_object_inline_chunks_209 = [];
1985
+ var JSCompiler_object_inline_chunks_205 = [];
1970
1986
  value.on("data", function (chunk) {
1971
- JSCompiler_object_inline_chunks_209.push(chunk);
1987
+ JSCompiler_object_inline_chunks_205.push(chunk);
1972
1988
  });
1973
1989
  value.on("end", function () {
1974
- var blob = new Blob(JSCompiler_object_inline_chunks_209, {
1990
+ var blob = new Blob(JSCompiler_object_inline_chunks_205, {
1975
1991
  type: mimeType
1976
1992
  });
1977
1993
  response._formData.append(name, blob, filename);
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.0.0-beta-e7d213dfb0-20240507",
4
+ "version": "19.0.0-beta-6946ebe620-20240508",
5
5
  "keywords": [
6
6
  "react"
7
7
  ],
@@ -77,8 +77,8 @@
77
77
  "node": ">=0.10.0"
78
78
  },
79
79
  "peerDependencies": {
80
- "react": "19.0.0-beta-e7d213dfb0-20240507",
81
- "react-dom": "19.0.0-beta-e7d213dfb0-20240507",
80
+ "react": "19.0.0-beta-6946ebe620-20240508",
81
+ "react-dom": "19.0.0-beta-6946ebe620-20240508",
82
82
  "webpack": "^5.59.0"
83
83
  },
84
84
  "dependencies": {