react-server-dom-webpack 19.0.0-rc-58af67a8f8-20240628 → 19.0.0-rc-9c6806964f-20240703

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.
@@ -79,6 +79,9 @@
79
79
  function stringToChunk(content) {
80
80
  return textEncoder.encode(content);
81
81
  }
82
+ function byteLengthOfChunk(chunk) {
83
+ return chunk.byteLength;
84
+ }
82
85
  function closeWithError(destination, error) {
83
86
  "function" === typeof destination.error
84
87
  ? destination.error(error)
@@ -772,13 +775,14 @@
772
775
  key,
773
776
  Component,
774
777
  props,
775
- owner
778
+ owner,
779
+ stack,
780
+ debugTask
776
781
  ) {
777
- var prevThenableState = task.thenableState;
782
+ stack = task.thenableState;
778
783
  task.thenableState = null;
779
784
  if (null === debugID) return outlineTask(request, task);
780
- if (null !== prevThenableState)
781
- owner = prevThenableState._componentDebugInfo;
785
+ if (null !== stack) owner = stack._componentDebugInfo;
782
786
  else {
783
787
  var componentDebugID = debugID,
784
788
  componentName = Component.displayName || Component.name || "",
@@ -789,8 +793,8 @@
789
793
  emitDebugChunk(request, componentDebugID, owner);
790
794
  task.environmentName = componentEnv;
791
795
  }
792
- prepareToUseHooksForComponent(prevThenableState, owner);
793
- props = callComponentInDEV(Component, props, owner);
796
+ prepareToUseHooksForComponent(stack, owner);
797
+ props = callComponentInDEV(Component, props, owner, debugTask);
794
798
  if (1 === request.status) throw AbortSigil;
795
799
  if (
796
800
  "object" === typeof props &&
@@ -798,8 +802,8 @@
798
802
  props.$$typeof !== CLIENT_REFERENCE_TAG$1
799
803
  ) {
800
804
  if ("function" === typeof props.then) {
801
- prevThenableState = props;
802
- prevThenableState.then(
805
+ debugTask = props;
806
+ debugTask.then(
803
807
  function (resolvedValue) {
804
808
  "object" === typeof resolvedValue &&
805
809
  null !== resolvedValue &&
@@ -808,8 +812,7 @@
808
812
  },
809
813
  function () {}
810
814
  );
811
- if ("fulfilled" === prevThenableState.status)
812
- return prevThenableState.value;
815
+ if ("fulfilled" === debugTask.status) return debugTask.value;
813
816
  props = createLazyWrapperAroundWakeable(props);
814
817
  }
815
818
  var iteratorFn = getIteratorFn(props);
@@ -851,15 +854,14 @@
851
854
  props._debugInfo = _iterableChild._debugInfo;
852
855
  }
853
856
  }
854
- prevThenableState = task.keyPath;
855
- componentDebugID = task.implicitSlot;
857
+ debugTask = task.keyPath;
858
+ owner = task.implicitSlot;
856
859
  null !== key
857
- ? (task.keyPath =
858
- null === prevThenableState ? key : prevThenableState + "," + key)
859
- : null === prevThenableState && (task.implicitSlot = !0);
860
+ ? (task.keyPath = null === debugTask ? key : debugTask + "," + key)
861
+ : null === debugTask && (task.implicitSlot = !0);
860
862
  request = renderModelDestructive(request, task, emptyRoot, "", props);
861
- task.keyPath = prevThenableState;
862
- task.implicitSlot = componentDebugID;
863
+ task.keyPath = debugTask;
864
+ task.implicitSlot = owner;
863
865
  return request;
864
866
  }
865
867
  function renderFragment(request, task, children) {
@@ -903,7 +905,17 @@
903
905
  ? serializeByValueID(task.id)
904
906
  : serializeLazyID(task.id);
905
907
  }
906
- function renderElement(request, task, type, key, ref, props, owner) {
908
+ function renderElement(
909
+ request,
910
+ task,
911
+ type,
912
+ key,
913
+ ref,
914
+ props,
915
+ owner,
916
+ stack,
917
+ debugTask
918
+ ) {
907
919
  if (null !== ref && void 0 !== ref)
908
920
  throw Error(
909
921
  "Refs cannot be used in Server Components, nor passed to Client Components."
@@ -917,7 +929,16 @@
917
929
  type.$$typeof !== CLIENT_REFERENCE_TAG$1 &&
918
930
  type.$$typeof !== TEMPORARY_REFERENCE_TAG
919
931
  )
920
- return renderFunctionComponent(request, task, key, type, props, owner);
932
+ return renderFunctionComponent(
933
+ request,
934
+ task,
935
+ key,
936
+ type,
937
+ props,
938
+ owner,
939
+ stack,
940
+ debugTask
941
+ );
921
942
  if (type === REACT_FRAGMENT_TYPE && null === key)
922
943
  return (
923
944
  (owner = task.implicitSlot),
@@ -941,7 +962,17 @@
941
962
  case REACT_LAZY_TYPE:
942
963
  type = callLazyInitInDEV(type);
943
964
  if (1 === request.status) throw AbortSigil;
944
- return renderElement(request, task, type, key, ref, props, owner);
965
+ return renderElement(
966
+ request,
967
+ task,
968
+ type,
969
+ key,
970
+ ref,
971
+ props,
972
+ owner,
973
+ stack,
974
+ debugTask
975
+ );
945
976
  case REACT_FORWARD_REF_TYPE:
946
977
  return renderFunctionComponent(
947
978
  request,
@@ -949,7 +980,9 @@
949
980
  key,
950
981
  type.render,
951
982
  props,
952
- owner
983
+ owner,
984
+ stack,
985
+ debugTask
953
986
  );
954
987
  case REACT_MEMO_TYPE:
955
988
  return renderElement(
@@ -959,7 +992,9 @@
959
992
  key,
960
993
  ref,
961
994
  props,
962
- owner
995
+ owner,
996
+ stack,
997
+ debugTask
963
998
  );
964
999
  case REACT_ELEMENT_TYPE:
965
1000
  type._store.validated = 1;
@@ -1275,7 +1310,9 @@
1275
1310
  value.key,
1276
1311
  void 0 !== parent ? parent : null,
1277
1312
  parentPropertyName,
1278
- value._owner
1313
+ value._owner,
1314
+ null,
1315
+ null
1279
1316
  );
1280
1317
  "object" === typeof value &&
1281
1318
  null !== value &&
@@ -1488,7 +1525,7 @@
1488
1525
  return "Z" === value[value.length - 1] &&
1489
1526
  parent[parentPropertyName] instanceof Date
1490
1527
  ? "$D" + value
1491
- : 1024 <= value.length
1528
+ : 1024 <= value.length && null !== byteLengthOfChunk
1492
1529
  ? serializeLargeTextString(request, value)
1493
1530
  : "$" === value[0]
1494
1531
  ? "$" + value
@@ -1676,6 +1713,10 @@
1676
1713
  request.completedRegularChunks.push(id, typedArray);
1677
1714
  }
1678
1715
  function emitTextChunk(request, id, text) {
1716
+ if (null === byteLengthOfChunk)
1717
+ throw Error(
1718
+ "Existence of byteLengthOfChunk should have already been checked. This is a bug in React."
1719
+ );
1679
1720
  request.pendingChunks++;
1680
1721
  text = stringToChunk(text);
1681
1722
  var binaryLength = text.byteLength;
@@ -1832,7 +1873,7 @@
1832
1873
  }
1833
1874
  function emitChunk(request, task, value) {
1834
1875
  var id = task.id;
1835
- "string" === typeof value
1876
+ "string" === typeof value && null !== byteLengthOfChunk
1836
1877
  ? emitTextChunk(request, id, value)
1837
1878
  : value instanceof ArrayBuffer
1838
1879
  ? emitTypedArrayChunk(request, id, "A", new Uint8Array(value))
@@ -66,6 +66,9 @@ var textEncoder = new TextEncoder();
66
66
  function stringToChunk(content) {
67
67
  return textEncoder.encode(content);
68
68
  }
69
+ function byteLengthOfChunk(chunk) {
70
+ return chunk.byteLength;
71
+ }
69
72
  function closeWithError(destination, error) {
70
73
  "function" === typeof destination.error
71
74
  ? destination.error(error)
@@ -1472,7 +1475,7 @@ function renderModelDestructive(
1472
1475
  parent[parentPropertyName] instanceof Date
1473
1476
  )
1474
1477
  return "$D" + value;
1475
- if (1024 <= value.length)
1478
+ if (1024 <= value.length && null !== byteLengthOfChunk)
1476
1479
  return (
1477
1480
  request.pendingChunks++,
1478
1481
  (task = request.nextChunkId++),
@@ -1618,6 +1621,10 @@ function emitTypedArrayChunk(request, id, tag, typedArray) {
1618
1621
  request.completedRegularChunks.push(id, typedArray);
1619
1622
  }
1620
1623
  function emitTextChunk(request, id, text) {
1624
+ if (null === byteLengthOfChunk)
1625
+ throw Error(
1626
+ "Existence of byteLengthOfChunk should have already been checked. This is a bug in React."
1627
+ );
1621
1628
  request.pendingChunks++;
1622
1629
  text = stringToChunk(text);
1623
1630
  var binaryLength = text.byteLength;
@@ -1627,7 +1634,7 @@ function emitTextChunk(request, id, text) {
1627
1634
  }
1628
1635
  function emitChunk(request, task, value) {
1629
1636
  var id = task.id;
1630
- "string" === typeof value
1637
+ "string" === typeof value && null !== byteLengthOfChunk
1631
1638
  ? emitTextChunk(request, id, value)
1632
1639
  : value instanceof ArrayBuffer
1633
1640
  ? emitTypedArrayChunk(request, id, "A", new Uint8Array(value))
@@ -75,6 +75,9 @@
75
75
  function stringToChunk(content) {
76
76
  return textEncoder.encode(content);
77
77
  }
78
+ function byteLengthOfChunk(chunk) {
79
+ return chunk.byteLength;
80
+ }
78
81
  function closeWithError(destination, error) {
79
82
  "function" === typeof destination.error
80
83
  ? destination.error(error)
@@ -778,13 +781,14 @@
778
781
  key,
779
782
  Component,
780
783
  props,
781
- owner
784
+ owner,
785
+ stack,
786
+ debugTask
782
787
  ) {
783
- var prevThenableState = task.thenableState;
788
+ stack = task.thenableState;
784
789
  task.thenableState = null;
785
790
  if (null === debugID) return outlineTask(request, task);
786
- if (null !== prevThenableState)
787
- owner = prevThenableState._componentDebugInfo;
791
+ if (null !== stack) owner = stack._componentDebugInfo;
788
792
  else {
789
793
  var componentDebugID = debugID,
790
794
  componentName = Component.displayName || Component.name || "",
@@ -795,8 +799,8 @@
795
799
  emitDebugChunk(request, componentDebugID, owner);
796
800
  task.environmentName = componentEnv;
797
801
  }
798
- prepareToUseHooksForComponent(prevThenableState, owner);
799
- props = callComponentInDEV(Component, props, owner);
802
+ prepareToUseHooksForComponent(stack, owner);
803
+ props = callComponentInDEV(Component, props, owner, debugTask);
800
804
  if (1 === request.status) throw AbortSigil;
801
805
  if (
802
806
  "object" === typeof props &&
@@ -804,8 +808,8 @@
804
808
  props.$$typeof !== CLIENT_REFERENCE_TAG$1
805
809
  ) {
806
810
  if ("function" === typeof props.then) {
807
- prevThenableState = props;
808
- prevThenableState.then(
811
+ debugTask = props;
812
+ debugTask.then(
809
813
  function (resolvedValue) {
810
814
  "object" === typeof resolvedValue &&
811
815
  null !== resolvedValue &&
@@ -814,8 +818,7 @@
814
818
  },
815
819
  function () {}
816
820
  );
817
- if ("fulfilled" === prevThenableState.status)
818
- return prevThenableState.value;
821
+ if ("fulfilled" === debugTask.status) return debugTask.value;
819
822
  props = createLazyWrapperAroundWakeable(props);
820
823
  }
821
824
  var iteratorFn = getIteratorFn(props);
@@ -857,15 +860,14 @@
857
860
  props._debugInfo = _iterableChild._debugInfo;
858
861
  }
859
862
  }
860
- prevThenableState = task.keyPath;
861
- componentDebugID = task.implicitSlot;
863
+ debugTask = task.keyPath;
864
+ owner = task.implicitSlot;
862
865
  null !== key
863
- ? (task.keyPath =
864
- null === prevThenableState ? key : prevThenableState + "," + key)
865
- : null === prevThenableState && (task.implicitSlot = !0);
866
+ ? (task.keyPath = null === debugTask ? key : debugTask + "," + key)
867
+ : null === debugTask && (task.implicitSlot = !0);
866
868
  request = renderModelDestructive(request, task, emptyRoot, "", props);
867
- task.keyPath = prevThenableState;
868
- task.implicitSlot = componentDebugID;
869
+ task.keyPath = debugTask;
870
+ task.implicitSlot = owner;
869
871
  return request;
870
872
  }
871
873
  function renderFragment(request, task, children) {
@@ -909,7 +911,17 @@
909
911
  ? serializeByValueID(task.id)
910
912
  : serializeLazyID(task.id);
911
913
  }
912
- function renderElement(request, task, type, key, ref, props, owner) {
914
+ function renderElement(
915
+ request,
916
+ task,
917
+ type,
918
+ key,
919
+ ref,
920
+ props,
921
+ owner,
922
+ stack,
923
+ debugTask
924
+ ) {
913
925
  if (null !== ref && void 0 !== ref)
914
926
  throw Error(
915
927
  "Refs cannot be used in Server Components, nor passed to Client Components."
@@ -923,7 +935,16 @@
923
935
  type.$$typeof !== CLIENT_REFERENCE_TAG$1 &&
924
936
  type.$$typeof !== TEMPORARY_REFERENCE_TAG
925
937
  )
926
- return renderFunctionComponent(request, task, key, type, props, owner);
938
+ return renderFunctionComponent(
939
+ request,
940
+ task,
941
+ key,
942
+ type,
943
+ props,
944
+ owner,
945
+ stack,
946
+ debugTask
947
+ );
927
948
  if (type === REACT_FRAGMENT_TYPE && null === key)
928
949
  return (
929
950
  (owner = task.implicitSlot),
@@ -947,7 +968,17 @@
947
968
  case REACT_LAZY_TYPE:
948
969
  type = callLazyInitInDEV(type);
949
970
  if (1 === request.status) throw AbortSigil;
950
- return renderElement(request, task, type, key, ref, props, owner);
971
+ return renderElement(
972
+ request,
973
+ task,
974
+ type,
975
+ key,
976
+ ref,
977
+ props,
978
+ owner,
979
+ stack,
980
+ debugTask
981
+ );
951
982
  case REACT_FORWARD_REF_TYPE:
952
983
  return renderFunctionComponent(
953
984
  request,
@@ -955,7 +986,9 @@
955
986
  key,
956
987
  type.render,
957
988
  props,
958
- owner
989
+ owner,
990
+ stack,
991
+ debugTask
959
992
  );
960
993
  case REACT_MEMO_TYPE:
961
994
  return renderElement(
@@ -965,7 +998,9 @@
965
998
  key,
966
999
  ref,
967
1000
  props,
968
- owner
1001
+ owner,
1002
+ stack,
1003
+ debugTask
969
1004
  );
970
1005
  case REACT_ELEMENT_TYPE:
971
1006
  type._store.validated = 1;
@@ -1281,7 +1316,9 @@
1281
1316
  value.key,
1282
1317
  void 0 !== parent ? parent : null,
1283
1318
  parentPropertyName,
1284
- value._owner
1319
+ value._owner,
1320
+ null,
1321
+ null
1285
1322
  );
1286
1323
  "object" === typeof value &&
1287
1324
  null !== value &&
@@ -1494,7 +1531,7 @@
1494
1531
  return "Z" === value[value.length - 1] &&
1495
1532
  parent[parentPropertyName] instanceof Date
1496
1533
  ? "$D" + value
1497
- : 1024 <= value.length
1534
+ : 1024 <= value.length && null !== byteLengthOfChunk
1498
1535
  ? serializeLargeTextString(request, value)
1499
1536
  : "$" === value[0]
1500
1537
  ? "$" + value
@@ -1684,6 +1721,10 @@
1684
1721
  request.completedRegularChunks.push(id, typedArray);
1685
1722
  }
1686
1723
  function emitTextChunk(request, id, text) {
1724
+ if (null === byteLengthOfChunk)
1725
+ throw Error(
1726
+ "Existence of byteLengthOfChunk should have already been checked. This is a bug in React."
1727
+ );
1687
1728
  request.pendingChunks++;
1688
1729
  text = stringToChunk(text);
1689
1730
  var binaryLength = text.byteLength;
@@ -1840,7 +1881,7 @@
1840
1881
  }
1841
1882
  function emitChunk(request, task, value) {
1842
1883
  var id = task.id;
1843
- "string" === typeof value
1884
+ "string" === typeof value && null !== byteLengthOfChunk
1844
1885
  ? emitTextChunk(request, id, value)
1845
1886
  : value instanceof ArrayBuffer
1846
1887
  ? emitTypedArrayChunk(request, id, "A", new Uint8Array(value))
@@ -56,6 +56,9 @@ var textEncoder = new TextEncoder();
56
56
  function stringToChunk(content) {
57
57
  return textEncoder.encode(content);
58
58
  }
59
+ function byteLengthOfChunk(chunk) {
60
+ return chunk.byteLength;
61
+ }
59
62
  function closeWithError(destination, error) {
60
63
  "function" === typeof destination.error
61
64
  ? destination.error(error)
@@ -1477,7 +1480,7 @@ function renderModelDestructive(
1477
1480
  parent[parentPropertyName] instanceof Date
1478
1481
  )
1479
1482
  return "$D" + value;
1480
- if (1024 <= value.length)
1483
+ if (1024 <= value.length && null !== byteLengthOfChunk)
1481
1484
  return (
1482
1485
  request.pendingChunks++,
1483
1486
  (task = request.nextChunkId++),
@@ -1625,6 +1628,10 @@ function emitTypedArrayChunk(request, id, tag, typedArray) {
1625
1628
  request.completedRegularChunks.push(id, typedArray);
1626
1629
  }
1627
1630
  function emitTextChunk(request, id, text) {
1631
+ if (null === byteLengthOfChunk)
1632
+ throw Error(
1633
+ "Existence of byteLengthOfChunk should have already been checked. This is a bug in React."
1634
+ );
1628
1635
  request.pendingChunks++;
1629
1636
  text = stringToChunk(text);
1630
1637
  var binaryLength = text.byteLength;
@@ -1634,7 +1641,7 @@ function emitTextChunk(request, id, text) {
1634
1641
  }
1635
1642
  function emitChunk(request, task, value) {
1636
1643
  var id = task.id;
1637
- "string" === typeof value
1644
+ "string" === typeof value && null !== byteLengthOfChunk
1638
1645
  ? emitTextChunk(request, id, value)
1639
1646
  : value instanceof ArrayBuffer
1640
1647
  ? emitTypedArrayChunk(request, id, "A", new Uint8Array(value))
@@ -105,6 +105,11 @@
105
105
  (writtenBytes = 0))));
106
106
  return destinationHasCapacity;
107
107
  }
108
+ function byteLengthOfChunk(chunk) {
109
+ return "string" === typeof chunk
110
+ ? Buffer.byteLength(chunk, "utf8")
111
+ : chunk.byteLength;
112
+ }
108
113
  function registerClientReferenceImpl(proxyImplementation, id, async) {
109
114
  return Object.defineProperties(proxyImplementation, {
110
115
  $$typeof: { value: CLIENT_REFERENCE_TAG$1 },
@@ -802,13 +807,14 @@
802
807
  key,
803
808
  Component,
804
809
  props,
805
- owner
810
+ owner,
811
+ stack,
812
+ debugTask
806
813
  ) {
807
- var prevThenableState = task.thenableState;
814
+ stack = task.thenableState;
808
815
  task.thenableState = null;
809
816
  if (null === debugID) return outlineTask(request, task);
810
- if (null !== prevThenableState)
811
- owner = prevThenableState._componentDebugInfo;
817
+ if (null !== stack) owner = stack._componentDebugInfo;
812
818
  else {
813
819
  var componentDebugID = debugID,
814
820
  componentName = Component.displayName || Component.name || "",
@@ -819,8 +825,8 @@
819
825
  emitDebugChunk(request, componentDebugID, owner);
820
826
  task.environmentName = componentEnv;
821
827
  }
822
- prepareToUseHooksForComponent(prevThenableState, owner);
823
- props = callComponentInDEV(Component, props, owner);
828
+ prepareToUseHooksForComponent(stack, owner);
829
+ props = callComponentInDEV(Component, props, owner, debugTask);
824
830
  if (1 === request.status) throw AbortSigil;
825
831
  if (
826
832
  "object" === typeof props &&
@@ -828,8 +834,8 @@
828
834
  props.$$typeof !== CLIENT_REFERENCE_TAG$1
829
835
  ) {
830
836
  if ("function" === typeof props.then) {
831
- prevThenableState = props;
832
- prevThenableState.then(
837
+ debugTask = props;
838
+ debugTask.then(
833
839
  function (resolvedValue) {
834
840
  "object" === typeof resolvedValue &&
835
841
  null !== resolvedValue &&
@@ -838,8 +844,7 @@
838
844
  },
839
845
  function () {}
840
846
  );
841
- if ("fulfilled" === prevThenableState.status)
842
- return prevThenableState.value;
847
+ if ("fulfilled" === debugTask.status) return debugTask.value;
843
848
  props = createLazyWrapperAroundWakeable(props);
844
849
  }
845
850
  var iteratorFn = getIteratorFn(props);
@@ -881,15 +886,14 @@
881
886
  props._debugInfo = _iterableChild._debugInfo;
882
887
  }
883
888
  }
884
- prevThenableState = task.keyPath;
885
- componentDebugID = task.implicitSlot;
889
+ debugTask = task.keyPath;
890
+ owner = task.implicitSlot;
886
891
  null !== key
887
- ? (task.keyPath =
888
- null === prevThenableState ? key : prevThenableState + "," + key)
889
- : null === prevThenableState && (task.implicitSlot = !0);
892
+ ? (task.keyPath = null === debugTask ? key : debugTask + "," + key)
893
+ : null === debugTask && (task.implicitSlot = !0);
890
894
  request = renderModelDestructive(request, task, emptyRoot, "", props);
891
- task.keyPath = prevThenableState;
892
- task.implicitSlot = componentDebugID;
895
+ task.keyPath = debugTask;
896
+ task.implicitSlot = owner;
893
897
  return request;
894
898
  }
895
899
  function renderFragment(request, task, children) {
@@ -933,7 +937,17 @@
933
937
  ? serializeByValueID(task.id)
934
938
  : serializeLazyID(task.id);
935
939
  }
936
- function renderElement(request, task, type, key, ref, props, owner) {
940
+ function renderElement(
941
+ request,
942
+ task,
943
+ type,
944
+ key,
945
+ ref,
946
+ props,
947
+ owner,
948
+ stack,
949
+ debugTask
950
+ ) {
937
951
  if (null !== ref && void 0 !== ref)
938
952
  throw Error(
939
953
  "Refs cannot be used in Server Components, nor passed to Client Components."
@@ -947,7 +961,16 @@
947
961
  type.$$typeof !== CLIENT_REFERENCE_TAG$1 &&
948
962
  type.$$typeof !== TEMPORARY_REFERENCE_TAG
949
963
  )
950
- return renderFunctionComponent(request, task, key, type, props, owner);
964
+ return renderFunctionComponent(
965
+ request,
966
+ task,
967
+ key,
968
+ type,
969
+ props,
970
+ owner,
971
+ stack,
972
+ debugTask
973
+ );
951
974
  if (type === REACT_FRAGMENT_TYPE && null === key)
952
975
  return (
953
976
  (owner = task.implicitSlot),
@@ -971,7 +994,17 @@
971
994
  case REACT_LAZY_TYPE:
972
995
  type = callLazyInitInDEV(type);
973
996
  if (1 === request.status) throw AbortSigil;
974
- return renderElement(request, task, type, key, ref, props, owner);
997
+ return renderElement(
998
+ request,
999
+ task,
1000
+ type,
1001
+ key,
1002
+ ref,
1003
+ props,
1004
+ owner,
1005
+ stack,
1006
+ debugTask
1007
+ );
975
1008
  case REACT_FORWARD_REF_TYPE:
976
1009
  return renderFunctionComponent(
977
1010
  request,
@@ -979,7 +1012,9 @@
979
1012
  key,
980
1013
  type.render,
981
1014
  props,
982
- owner
1015
+ owner,
1016
+ stack,
1017
+ debugTask
983
1018
  );
984
1019
  case REACT_MEMO_TYPE:
985
1020
  return renderElement(
@@ -989,7 +1024,9 @@
989
1024
  key,
990
1025
  ref,
991
1026
  props,
992
- owner
1027
+ owner,
1028
+ stack,
1029
+ debugTask
993
1030
  );
994
1031
  case REACT_ELEMENT_TYPE:
995
1032
  type._store.validated = 1;
@@ -1303,7 +1340,9 @@
1303
1340
  value.key,
1304
1341
  void 0 !== parent ? parent : null,
1305
1342
  parentPropertyName,
1306
- value._owner
1343
+ value._owner,
1344
+ null,
1345
+ null
1307
1346
  );
1308
1347
  "object" === typeof value &&
1309
1348
  null !== value &&
@@ -1516,7 +1555,7 @@
1516
1555
  return "Z" === value[value.length - 1] &&
1517
1556
  parent[parentPropertyName] instanceof Date
1518
1557
  ? "$D" + value
1519
- : 1024 <= value.length
1558
+ : 1024 <= value.length && null !== byteLengthOfChunk
1520
1559
  ? serializeLargeTextString(request, value)
1521
1560
  : "$" === value[0]
1522
1561
  ? "$" + value
@@ -1697,11 +1736,12 @@
1697
1736
  request.completedRegularChunks.push(id, typedArray);
1698
1737
  }
1699
1738
  function emitTextChunk(request, id, text) {
1739
+ if (null === byteLengthOfChunk)
1740
+ throw Error(
1741
+ "Existence of byteLengthOfChunk should have already been checked. This is a bug in React."
1742
+ );
1700
1743
  request.pendingChunks++;
1701
- var binaryLength =
1702
- "string" === typeof text
1703
- ? Buffer.byteLength(text, "utf8")
1704
- : text.byteLength;
1744
+ var binaryLength = byteLengthOfChunk(text);
1705
1745
  id = id.toString(16) + ":T" + binaryLength.toString(16) + ",";
1706
1746
  request.completedRegularChunks.push(id, text);
1707
1747
  }
@@ -1853,7 +1893,7 @@
1853
1893
  }
1854
1894
  function emitChunk(request, task, value) {
1855
1895
  var id = task.id;
1856
- "string" === typeof value
1896
+ "string" === typeof value && null !== byteLengthOfChunk
1857
1897
  ? emitTextChunk(request, id, value)
1858
1898
  : value instanceof ArrayBuffer
1859
1899
  ? emitTypedArrayChunk(request, id, "A", new Uint8Array(value))
@@ -3366,12 +3406,12 @@
3366
3406
  "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."
3367
3407
  );
3368
3408
  pendingFiles++;
3369
- var JSCompiler_object_inline_chunks_158 = [];
3409
+ var JSCompiler_object_inline_chunks_156 = [];
3370
3410
  value.on("data", function (chunk) {
3371
- JSCompiler_object_inline_chunks_158.push(chunk);
3411
+ JSCompiler_object_inline_chunks_156.push(chunk);
3372
3412
  });
3373
3413
  value.on("end", function () {
3374
- var blob = new Blob(JSCompiler_object_inline_chunks_158, {
3414
+ var blob = new Blob(JSCompiler_object_inline_chunks_156, {
3375
3415
  type: mimeType
3376
3416
  });
3377
3417
  response._formData.append(name, blob, filename);
@@ -84,8 +84,13 @@ function writeChunkAndReturn(destination, chunk) {
84
84
  (writtenBytes = 0))));
85
85
  return destinationHasCapacity;
86
86
  }
87
- var textEncoder = new util.TextEncoder(),
88
- CLIENT_REFERENCE_TAG$1 = Symbol.for("react.client.reference"),
87
+ var textEncoder = new util.TextEncoder();
88
+ function byteLengthOfChunk(chunk) {
89
+ return "string" === typeof chunk
90
+ ? Buffer.byteLength(chunk, "utf8")
91
+ : chunk.byteLength;
92
+ }
93
+ var CLIENT_REFERENCE_TAG$1 = Symbol.for("react.client.reference"),
89
94
  SERVER_REFERENCE_TAG = Symbol.for("react.server.reference");
90
95
  function registerClientReferenceImpl(proxyImplementation, id, async) {
91
96
  return Object.defineProperties(proxyImplementation, {
@@ -1488,7 +1493,7 @@ function renderModelDestructive(
1488
1493
  parent[parentPropertyName] instanceof Date
1489
1494
  )
1490
1495
  return "$D" + value;
1491
- if (1024 <= value.length)
1496
+ if (1024 <= value.length && null !== byteLengthOfChunk)
1492
1497
  return (
1493
1498
  request.pendingChunks++,
1494
1499
  (task = request.nextChunkId++),
@@ -1629,17 +1634,18 @@ function emitTypedArrayChunk(request, id, tag, typedArray) {
1629
1634
  request.completedRegularChunks.push(id, typedArray);
1630
1635
  }
1631
1636
  function emitTextChunk(request, id, text) {
1637
+ if (null === byteLengthOfChunk)
1638
+ throw Error(
1639
+ "Existence of byteLengthOfChunk should have already been checked. This is a bug in React."
1640
+ );
1632
1641
  request.pendingChunks++;
1633
- var binaryLength =
1634
- "string" === typeof text
1635
- ? Buffer.byteLength(text, "utf8")
1636
- : text.byteLength;
1642
+ var binaryLength = byteLengthOfChunk(text);
1637
1643
  id = id.toString(16) + ":T" + binaryLength.toString(16) + ",";
1638
1644
  request.completedRegularChunks.push(id, text);
1639
1645
  }
1640
1646
  function emitChunk(request, task, value) {
1641
1647
  var id = task.id;
1642
- "string" === typeof value
1648
+ "string" === typeof value && null !== byteLengthOfChunk
1643
1649
  ? emitTextChunk(request, id, value)
1644
1650
  : value instanceof ArrayBuffer
1645
1651
  ? emitTypedArrayChunk(request, id, "A", new Uint8Array(value))
@@ -105,6 +105,11 @@
105
105
  (writtenBytes = 0))));
106
106
  return destinationHasCapacity;
107
107
  }
108
+ function byteLengthOfChunk(chunk) {
109
+ return "string" === typeof chunk
110
+ ? Buffer.byteLength(chunk, "utf8")
111
+ : chunk.byteLength;
112
+ }
108
113
  function registerClientReferenceImpl(proxyImplementation, id, async) {
109
114
  return Object.defineProperties(proxyImplementation, {
110
115
  $$typeof: { value: CLIENT_REFERENCE_TAG$1 },
@@ -802,13 +807,14 @@
802
807
  key,
803
808
  Component,
804
809
  props,
805
- owner
810
+ owner,
811
+ stack,
812
+ debugTask
806
813
  ) {
807
- var prevThenableState = task.thenableState;
814
+ stack = task.thenableState;
808
815
  task.thenableState = null;
809
816
  if (null === debugID) return outlineTask(request, task);
810
- if (null !== prevThenableState)
811
- owner = prevThenableState._componentDebugInfo;
817
+ if (null !== stack) owner = stack._componentDebugInfo;
812
818
  else {
813
819
  var componentDebugID = debugID,
814
820
  componentName = Component.displayName || Component.name || "",
@@ -819,8 +825,8 @@
819
825
  emitDebugChunk(request, componentDebugID, owner);
820
826
  task.environmentName = componentEnv;
821
827
  }
822
- prepareToUseHooksForComponent(prevThenableState, owner);
823
- props = callComponentInDEV(Component, props, owner);
828
+ prepareToUseHooksForComponent(stack, owner);
829
+ props = callComponentInDEV(Component, props, owner, debugTask);
824
830
  if (1 === request.status) throw AbortSigil;
825
831
  if (
826
832
  "object" === typeof props &&
@@ -828,8 +834,8 @@
828
834
  props.$$typeof !== CLIENT_REFERENCE_TAG$1
829
835
  ) {
830
836
  if ("function" === typeof props.then) {
831
- prevThenableState = props;
832
- prevThenableState.then(
837
+ debugTask = props;
838
+ debugTask.then(
833
839
  function (resolvedValue) {
834
840
  "object" === typeof resolvedValue &&
835
841
  null !== resolvedValue &&
@@ -838,8 +844,7 @@
838
844
  },
839
845
  function () {}
840
846
  );
841
- if ("fulfilled" === prevThenableState.status)
842
- return prevThenableState.value;
847
+ if ("fulfilled" === debugTask.status) return debugTask.value;
843
848
  props = createLazyWrapperAroundWakeable(props);
844
849
  }
845
850
  var iteratorFn = getIteratorFn(props);
@@ -881,15 +886,14 @@
881
886
  props._debugInfo = _iterableChild._debugInfo;
882
887
  }
883
888
  }
884
- prevThenableState = task.keyPath;
885
- componentDebugID = task.implicitSlot;
889
+ debugTask = task.keyPath;
890
+ owner = task.implicitSlot;
886
891
  null !== key
887
- ? (task.keyPath =
888
- null === prevThenableState ? key : prevThenableState + "," + key)
889
- : null === prevThenableState && (task.implicitSlot = !0);
892
+ ? (task.keyPath = null === debugTask ? key : debugTask + "," + key)
893
+ : null === debugTask && (task.implicitSlot = !0);
890
894
  request = renderModelDestructive(request, task, emptyRoot, "", props);
891
- task.keyPath = prevThenableState;
892
- task.implicitSlot = componentDebugID;
895
+ task.keyPath = debugTask;
896
+ task.implicitSlot = owner;
893
897
  return request;
894
898
  }
895
899
  function renderFragment(request, task, children) {
@@ -933,7 +937,17 @@
933
937
  ? serializeByValueID(task.id)
934
938
  : serializeLazyID(task.id);
935
939
  }
936
- function renderElement(request, task, type, key, ref, props, owner) {
940
+ function renderElement(
941
+ request,
942
+ task,
943
+ type,
944
+ key,
945
+ ref,
946
+ props,
947
+ owner,
948
+ stack,
949
+ debugTask
950
+ ) {
937
951
  if (null !== ref && void 0 !== ref)
938
952
  throw Error(
939
953
  "Refs cannot be used in Server Components, nor passed to Client Components."
@@ -947,7 +961,16 @@
947
961
  type.$$typeof !== CLIENT_REFERENCE_TAG$1 &&
948
962
  type.$$typeof !== TEMPORARY_REFERENCE_TAG
949
963
  )
950
- return renderFunctionComponent(request, task, key, type, props, owner);
964
+ return renderFunctionComponent(
965
+ request,
966
+ task,
967
+ key,
968
+ type,
969
+ props,
970
+ owner,
971
+ stack,
972
+ debugTask
973
+ );
951
974
  if (type === REACT_FRAGMENT_TYPE && null === key)
952
975
  return (
953
976
  (owner = task.implicitSlot),
@@ -971,7 +994,17 @@
971
994
  case REACT_LAZY_TYPE:
972
995
  type = callLazyInitInDEV(type);
973
996
  if (1 === request.status) throw AbortSigil;
974
- return renderElement(request, task, type, key, ref, props, owner);
997
+ return renderElement(
998
+ request,
999
+ task,
1000
+ type,
1001
+ key,
1002
+ ref,
1003
+ props,
1004
+ owner,
1005
+ stack,
1006
+ debugTask
1007
+ );
975
1008
  case REACT_FORWARD_REF_TYPE:
976
1009
  return renderFunctionComponent(
977
1010
  request,
@@ -979,7 +1012,9 @@
979
1012
  key,
980
1013
  type.render,
981
1014
  props,
982
- owner
1015
+ owner,
1016
+ stack,
1017
+ debugTask
983
1018
  );
984
1019
  case REACT_MEMO_TYPE:
985
1020
  return renderElement(
@@ -989,7 +1024,9 @@
989
1024
  key,
990
1025
  ref,
991
1026
  props,
992
- owner
1027
+ owner,
1028
+ stack,
1029
+ debugTask
993
1030
  );
994
1031
  case REACT_ELEMENT_TYPE:
995
1032
  type._store.validated = 1;
@@ -1303,7 +1340,9 @@
1303
1340
  value.key,
1304
1341
  void 0 !== parent ? parent : null,
1305
1342
  parentPropertyName,
1306
- value._owner
1343
+ value._owner,
1344
+ null,
1345
+ null
1307
1346
  );
1308
1347
  "object" === typeof value &&
1309
1348
  null !== value &&
@@ -1516,7 +1555,7 @@
1516
1555
  return "Z" === value[value.length - 1] &&
1517
1556
  parent[parentPropertyName] instanceof Date
1518
1557
  ? "$D" + value
1519
- : 1024 <= value.length
1558
+ : 1024 <= value.length && null !== byteLengthOfChunk
1520
1559
  ? serializeLargeTextString(request, value)
1521
1560
  : "$" === value[0]
1522
1561
  ? "$" + value
@@ -1697,11 +1736,12 @@
1697
1736
  request.completedRegularChunks.push(id, typedArray);
1698
1737
  }
1699
1738
  function emitTextChunk(request, id, text) {
1739
+ if (null === byteLengthOfChunk)
1740
+ throw Error(
1741
+ "Existence of byteLengthOfChunk should have already been checked. This is a bug in React."
1742
+ );
1700
1743
  request.pendingChunks++;
1701
- var binaryLength =
1702
- "string" === typeof text
1703
- ? Buffer.byteLength(text, "utf8")
1704
- : text.byteLength;
1744
+ var binaryLength = byteLengthOfChunk(text);
1705
1745
  id = id.toString(16) + ":T" + binaryLength.toString(16) + ",";
1706
1746
  request.completedRegularChunks.push(id, text);
1707
1747
  }
@@ -1853,7 +1893,7 @@
1853
1893
  }
1854
1894
  function emitChunk(request, task, value) {
1855
1895
  var id = task.id;
1856
- "string" === typeof value
1896
+ "string" === typeof value && null !== byteLengthOfChunk
1857
1897
  ? emitTextChunk(request, id, value)
1858
1898
  : value instanceof ArrayBuffer
1859
1899
  ? emitTypedArrayChunk(request, id, "A", new Uint8Array(value))
@@ -3331,12 +3371,12 @@
3331
3371
  "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."
3332
3372
  );
3333
3373
  pendingFiles++;
3334
- var JSCompiler_object_inline_chunks_158 = [];
3374
+ var JSCompiler_object_inline_chunks_156 = [];
3335
3375
  value.on("data", function (chunk) {
3336
- JSCompiler_object_inline_chunks_158.push(chunk);
3376
+ JSCompiler_object_inline_chunks_156.push(chunk);
3337
3377
  });
3338
3378
  value.on("end", function () {
3339
- var blob = new Blob(JSCompiler_object_inline_chunks_158, {
3379
+ var blob = new Blob(JSCompiler_object_inline_chunks_156, {
3340
3380
  type: mimeType
3341
3381
  });
3342
3382
  response._formData.append(name, blob, filename);
@@ -84,8 +84,13 @@ function writeChunkAndReturn(destination, chunk) {
84
84
  (writtenBytes = 0))));
85
85
  return destinationHasCapacity;
86
86
  }
87
- var textEncoder = new util.TextEncoder(),
88
- CLIENT_REFERENCE_TAG$1 = Symbol.for("react.client.reference"),
87
+ var textEncoder = new util.TextEncoder();
88
+ function byteLengthOfChunk(chunk) {
89
+ return "string" === typeof chunk
90
+ ? Buffer.byteLength(chunk, "utf8")
91
+ : chunk.byteLength;
92
+ }
93
+ var CLIENT_REFERENCE_TAG$1 = Symbol.for("react.client.reference"),
89
94
  SERVER_REFERENCE_TAG = Symbol.for("react.server.reference");
90
95
  function registerClientReferenceImpl(proxyImplementation, id, async) {
91
96
  return Object.defineProperties(proxyImplementation, {
@@ -1488,7 +1493,7 @@ function renderModelDestructive(
1488
1493
  parent[parentPropertyName] instanceof Date
1489
1494
  )
1490
1495
  return "$D" + value;
1491
- if (1024 <= value.length)
1496
+ if (1024 <= value.length && null !== byteLengthOfChunk)
1492
1497
  return (
1493
1498
  request.pendingChunks++,
1494
1499
  (task = request.nextChunkId++),
@@ -1629,17 +1634,18 @@ function emitTypedArrayChunk(request, id, tag, typedArray) {
1629
1634
  request.completedRegularChunks.push(id, typedArray);
1630
1635
  }
1631
1636
  function emitTextChunk(request, id, text) {
1637
+ if (null === byteLengthOfChunk)
1638
+ throw Error(
1639
+ "Existence of byteLengthOfChunk should have already been checked. This is a bug in React."
1640
+ );
1632
1641
  request.pendingChunks++;
1633
- var binaryLength =
1634
- "string" === typeof text
1635
- ? Buffer.byteLength(text, "utf8")
1636
- : text.byteLength;
1642
+ var binaryLength = byteLengthOfChunk(text);
1637
1643
  id = id.toString(16) + ":T" + binaryLength.toString(16) + ",";
1638
1644
  request.completedRegularChunks.push(id, text);
1639
1645
  }
1640
1646
  function emitChunk(request, task, value) {
1641
1647
  var id = task.id;
1642
- "string" === typeof value
1648
+ "string" === typeof value && null !== byteLengthOfChunk
1643
1649
  ? emitTextChunk(request, id, value)
1644
1650
  : value instanceof ArrayBuffer
1645
1651
  ? emitTypedArrayChunk(request, id, "A", new Uint8Array(value))
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-rc-58af67a8f8-20240628",
4
+ "version": "19.0.0-rc-9c6806964f-20240703",
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-rc-58af67a8f8-20240628",
81
- "react-dom": "19.0.0-rc-58af67a8f8-20240628",
80
+ "react": "19.0.0-rc-9c6806964f-20240703",
81
+ "react-dom": "19.0.0-rc-9c6806964f-20240703",
82
82
  "webpack": "^5.59.0"
83
83
  },
84
84
  "dependencies": {