react-server-dom-webpack 19.0.0-rc-d48603a5-20240813 → 19.0.0-rc-49496d49-20240814

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.
@@ -11,6 +11,7 @@
11
11
  "use strict";
12
12
  "production" !== process.env.NODE_ENV &&
13
13
  (function () {
14
+ function voidHandler() {}
14
15
  function _defineProperty(obj, key, value) {
15
16
  key in obj
16
17
  ? Object.defineProperty(obj, key, {
@@ -93,6 +94,9 @@
93
94
  ? Buffer.byteLength(chunk, "utf8")
94
95
  : chunk.byteLength;
95
96
  }
97
+ function isClientReference(reference) {
98
+ return reference.$$typeof === CLIENT_REFERENCE_TAG$1;
99
+ }
96
100
  function registerClientReferenceImpl(proxyImplementation, id, async) {
97
101
  return Object.defineProperties(proxyImplementation, {
98
102
  $$typeof: { value: CLIENT_REFERENCE_TAG$1 },
@@ -601,6 +605,8 @@
601
605
  task = thenable.reason;
602
606
  var digest = logRecoverableError(request, task, null);
603
607
  emitErrorChunk(request, newTask.id, digest, task);
608
+ newTask.status = 4;
609
+ request.abortableTasks.delete(newTask);
604
610
  return newTask.id;
605
611
  default:
606
612
  if (1 === request.status)
@@ -631,9 +637,9 @@
631
637
  pingTask(request, newTask);
632
638
  },
633
639
  function (reason) {
634
- newTask.status = 4;
635
640
  var _digest = logRecoverableError(request, reason, newTask);
636
641
  emitErrorChunk(request, newTask.id, _digest, reason);
642
+ newTask.status = 4;
637
643
  request.abortableTasks.delete(newTask);
638
644
  enqueueFlush(request);
639
645
  }
@@ -841,23 +847,28 @@
841
847
  props,
842
848
  componentDebugInfo
843
849
  );
844
- if (1 === request.status) throw AbortSigil;
850
+ if (1 === request.status)
851
+ throw (
852
+ ("object" !== typeof props ||
853
+ null === props ||
854
+ "function" !== typeof props.then ||
855
+ isClientReference(props) ||
856
+ props.then(voidHandler, voidHandler),
857
+ null)
858
+ );
845
859
  if (
846
860
  "object" === typeof props &&
847
861
  null !== props &&
848
- props.$$typeof !== CLIENT_REFERENCE_TAG$1
862
+ !isClientReference(props)
849
863
  ) {
850
864
  if ("function" === typeof props.then) {
851
865
  prevThenableState = props;
852
- prevThenableState.then(
853
- function (resolvedValue) {
854
- "object" === typeof resolvedValue &&
855
- null !== resolvedValue &&
856
- resolvedValue.$$typeof === REACT_ELEMENT_TYPE &&
857
- (resolvedValue._store.validated = 1);
858
- },
859
- function () {}
860
- );
866
+ prevThenableState.then(function (resolvedValue) {
867
+ "object" === typeof resolvedValue &&
868
+ null !== resolvedValue &&
869
+ resolvedValue.$$typeof === REACT_ELEMENT_TYPE &&
870
+ (resolvedValue._store.validated = 1);
871
+ }, voidHandler);
861
872
  if ("fulfilled" === prevThenableState.status)
862
873
  return prevThenableState.value;
863
874
  props = createLazyWrapperAroundWakeable(props);
@@ -983,48 +994,48 @@
983
994
  null !== props.children &&
984
995
  jsxChildrenParents.set(props.children, type);
985
996
  if (
986
- "function" === typeof type &&
987
- type.$$typeof !== CLIENT_REFERENCE_TAG$1 &&
988
- type.$$typeof !== TEMPORARY_REFERENCE_TAG
989
- )
990
- return renderFunctionComponent(request, task, key, type, props);
991
- if (type === REACT_FRAGMENT_TYPE && null === key)
992
- return (
993
- (type = task.implicitSlot),
994
- null === task.keyPath && (task.implicitSlot = !0),
995
- (props = renderModelDestructive(
996
- request,
997
- task,
998
- emptyRoot,
999
- "",
1000
- props.children
1001
- )),
1002
- (task.implicitSlot = type),
1003
- props
1004
- );
1005
- if (
1006
- null != type &&
1007
- "object" === typeof type &&
1008
- type.$$typeof !== CLIENT_REFERENCE_TAG$1
1009
- )
1010
- switch (type.$$typeof) {
1011
- case REACT_LAZY_TYPE:
1012
- type = callLazyInitInDEV(type);
1013
- if (1 === request.status) throw AbortSigil;
1014
- return renderElement(request, task, type, key, ref, props);
1015
- case REACT_FORWARD_REF_TYPE:
1016
- return renderFunctionComponent(
997
+ "function" !== typeof type ||
998
+ isClientReference(type) ||
999
+ type.$$typeof === TEMPORARY_REFERENCE_TAG
1000
+ ) {
1001
+ if (type === REACT_FRAGMENT_TYPE && null === key)
1002
+ return (
1003
+ (type = task.implicitSlot),
1004
+ null === task.keyPath && (task.implicitSlot = !0),
1005
+ (props = renderModelDestructive(
1017
1006
  request,
1018
1007
  task,
1019
- key,
1020
- type.render,
1021
- props
1022
- );
1023
- case REACT_MEMO_TYPE:
1024
- return renderElement(request, task, type.type, key, ref, props);
1025
- case REACT_ELEMENT_TYPE:
1026
- type._store.validated = 1;
1027
- }
1008
+ emptyRoot,
1009
+ "",
1010
+ props.children
1011
+ )),
1012
+ (task.implicitSlot = type),
1013
+ props
1014
+ );
1015
+ if (
1016
+ null != type &&
1017
+ "object" === typeof type &&
1018
+ !isClientReference(type)
1019
+ )
1020
+ switch (type.$$typeof) {
1021
+ case REACT_LAZY_TYPE:
1022
+ type = callLazyInitInDEV(type);
1023
+ if (1 === request.status) throw null;
1024
+ return renderElement(request, task, type, key, ref, props);
1025
+ case REACT_FORWARD_REF_TYPE:
1026
+ return renderFunctionComponent(
1027
+ request,
1028
+ task,
1029
+ key,
1030
+ type.render,
1031
+ props
1032
+ );
1033
+ case REACT_MEMO_TYPE:
1034
+ return renderElement(request, task, type.type, key, ref, props);
1035
+ case REACT_ELEMENT_TYPE:
1036
+ type._store.validated = 1;
1037
+ }
1038
+ } else return renderFunctionComponent(request, task, key, type, props);
1028
1039
  request = key;
1029
1040
  key = task.keyPath;
1030
1041
  null === request
@@ -1320,7 +1331,7 @@
1320
1331
  ? serializeLazyID(request.id)
1321
1332
  : serializeByValueID(request.id);
1322
1333
  }
1323
- if (thrownValue === AbortSigil)
1334
+ if (1 === request.status)
1324
1335
  return (
1325
1336
  (task.status = 3),
1326
1337
  (task = request.fatalError),
@@ -1389,7 +1400,7 @@
1389
1400
  case REACT_LAZY_TYPE:
1390
1401
  task.thenableState = null;
1391
1402
  elementReference = callLazyInitInDEV(value);
1392
- if (1 === request.status) throw AbortSigil;
1403
+ if (1 === request.status) throw null;
1393
1404
  if ((_writtenObjects = value._debugInfo)) {
1394
1405
  if (null === debugID) return outlineTask(request, task);
1395
1406
  forwardDebugInfo(request, debugID, _writtenObjects);
@@ -1406,7 +1417,7 @@
1406
1417
  'A React Element from an older version of React was rendered. This is not supported. It can happen if:\n- Multiple copies of the "react" package is used.\n- A library pre-bundled an old copy of "react" or "react/jsx-runtime".\n- A compiler tries to "inline" JSX instead of using the runtime.'
1407
1418
  );
1408
1419
  }
1409
- if (value.$$typeof === CLIENT_REFERENCE_TAG$1)
1420
+ if (isClientReference(value))
1410
1421
  return serializeClientReference(
1411
1422
  request,
1412
1423
  parent,
@@ -1561,7 +1572,7 @@
1561
1572
  if ("number" === typeof value) return serializeNumber(value);
1562
1573
  if ("undefined" === typeof value) return "$undefined";
1563
1574
  if ("function" === typeof value) {
1564
- if (value.$$typeof === CLIENT_REFERENCE_TAG$1)
1575
+ if (isClientReference(value))
1565
1576
  return serializeClientReference(
1566
1577
  request,
1567
1578
  parent,
@@ -1797,7 +1808,7 @@
1797
1808
  var originalValue = parent[parentPropertyName];
1798
1809
  if (null === value) return null;
1799
1810
  if ("object" === typeof value) {
1800
- if (value.$$typeof === CLIENT_REFERENCE_TAG$1)
1811
+ if (isClientReference(value))
1801
1812
  return serializeClientReference(
1802
1813
  request,
1803
1814
  parent,
@@ -1908,7 +1919,7 @@
1908
1919
  if ("number" === typeof value) return serializeNumber(value);
1909
1920
  if ("undefined" === typeof value) return "$undefined";
1910
1921
  if ("function" === typeof value)
1911
- return value.$$typeof === CLIENT_REFERENCE_TAG$1
1922
+ return isClientReference(value)
1912
1923
  ? serializeClientReference(request, parent, parentPropertyName, value)
1913
1924
  : void 0 !== request.temporaryReferences &&
1914
1925
  ((request = request.temporaryReferences.get(value)),
@@ -2045,7 +2056,7 @@
2045
2056
  var ping = task.ping;
2046
2057
  x.then(ping, ping);
2047
2058
  }
2048
- else if (x === AbortSigil) {
2059
+ else if (1 === request.status) {
2049
2060
  request.abortableTasks.delete(task);
2050
2061
  task.status = 3;
2051
2062
  var _model = stringify(serializeByValueID(request.fatalError));
@@ -2185,7 +2196,7 @@
2185
2196
  }
2186
2197
  function abort(request, reason) {
2187
2198
  try {
2188
- request.status = 1;
2199
+ 0 === request.status && (request.status = 1);
2189
2200
  var abortableTasks = request.abortableTasks;
2190
2201
  if (0 < abortableTasks.size) {
2191
2202
  request.pendingChunks++;
@@ -3274,7 +3285,7 @@
3274
3285
  }
3275
3286
  usable.$$typeof === REACT_CONTEXT_TYPE && unsupportedContext();
3276
3287
  }
3277
- if (usable.$$typeof === CLIENT_REFERENCE_TAG$1) {
3288
+ if (isClientReference(usable)) {
3278
3289
  if (
3279
3290
  null != usable.value &&
3280
3291
  usable.value.$$typeof === REACT_CONTEXT_TYPE
@@ -3349,7 +3360,6 @@
3349
3360
  CLIENT_REFERENCE_TAG = Symbol.for("react.client.reference"),
3350
3361
  ObjectPrototype = Object.prototype,
3351
3362
  stringify = JSON.stringify,
3352
- AbortSigil = {},
3353
3363
  CLOSED = 3,
3354
3364
  currentRequest = null,
3355
3365
  debugID = null,
@@ -717,8 +717,7 @@ function describeObjectForErrorMessage(objectOrArray, expandedName) {
717
717
  : "\n " + str;
718
718
  }
719
719
  var ObjectPrototype = Object.prototype,
720
- stringify = JSON.stringify,
721
- AbortSigil = {};
720
+ stringify = JSON.stringify;
722
721
  function defaultErrorHandler(error) {
723
722
  console.error(error);
724
723
  }
@@ -790,6 +789,8 @@ function serializeThenable(request, task, thenable) {
790
789
  return (
791
790
  (task = logRecoverableError(request, thenable.reason, null)),
792
791
  emitErrorChunk(request, newTask.id, task),
792
+ (newTask.status = 4),
793
+ request.abortableTasks.delete(newTask),
793
794
  newTask.id
794
795
  );
795
796
  default:
@@ -821,9 +822,9 @@ function serializeThenable(request, task, thenable) {
821
822
  pingTask(request, newTask);
822
823
  },
823
824
  function (reason) {
824
- newTask.status = 4;
825
825
  reason = logRecoverableError(request, reason, newTask);
826
826
  emitErrorChunk(request, newTask.id, reason);
827
+ newTask.status = 4;
827
828
  request.abortableTasks.delete(newTask);
828
829
  enqueueFlush(request);
829
830
  }
@@ -980,13 +981,22 @@ function createLazyWrapperAroundWakeable(wakeable) {
980
981
  }
981
982
  return { $$typeof: REACT_LAZY_TYPE, _payload: wakeable, _init: readThenable };
982
983
  }
984
+ function voidHandler() {}
983
985
  function renderFunctionComponent(request, task, key, Component, props) {
984
986
  var prevThenableState = task.thenableState;
985
987
  task.thenableState = null;
986
988
  thenableIndexCounter = 0;
987
989
  thenableState = prevThenableState;
988
990
  Component = Component(props, void 0);
989
- if (1 === request.status) throw AbortSigil;
991
+ if (1 === request.status)
992
+ throw (
993
+ ("object" === typeof Component &&
994
+ null !== Component &&
995
+ "function" === typeof Component.then &&
996
+ Component.$$typeof !== CLIENT_REFERENCE_TAG$1 &&
997
+ Component.then(voidHandler, voidHandler),
998
+ null)
999
+ );
990
1000
  if (
991
1001
  "object" === typeof Component &&
992
1002
  null !== Component &&
@@ -1077,7 +1087,7 @@ function renderElement(request, task, type, key, ref, props) {
1077
1087
  case REACT_LAZY_TYPE:
1078
1088
  var init = type._init;
1079
1089
  type = init(type._payload);
1080
- if (1 === request.status) throw AbortSigil;
1090
+ if (1 === request.status) throw null;
1081
1091
  return renderElement(request, task, type, key, ref, props);
1082
1092
  case REACT_FORWARD_REF_TYPE:
1083
1093
  return renderFunctionComponent(request, task, key, type.render, props);
@@ -1171,7 +1181,7 @@ function createTask(request, model, keyPath, implicitSlot, abortSet) {
1171
1181
  : serializeByValueID(JSCompiler_inline_result.id);
1172
1182
  }
1173
1183
  else
1174
- thrownValue === AbortSigil
1184
+ 1 === request.status
1175
1185
  ? ((task.status = 3),
1176
1186
  (prevKeyPath = request.fatalError),
1177
1187
  (JSCompiler_inline_result = parentPropertyName
@@ -1347,7 +1357,7 @@ function renderModelDestructive(
1347
1357
  task.thenableState = null;
1348
1358
  parentPropertyName = value._init;
1349
1359
  value = parentPropertyName(value._payload);
1350
- if (1 === request.status) throw AbortSigil;
1360
+ if (1 === request.status) throw null;
1351
1361
  return renderModelDestructive(request, task, emptyRoot, "", value);
1352
1362
  case REACT_LEGACY_ELEMENT_TYPE:
1353
1363
  throw Error(
@@ -1718,7 +1728,7 @@ function retryTask(request, task) {
1718
1728
  var ping = task.ping;
1719
1729
  x.then(ping, ping);
1720
1730
  }
1721
- else if (x === AbortSigil) {
1731
+ else if (1 === request.status) {
1722
1732
  request.abortableTasks.delete(task);
1723
1733
  task.status = 3;
1724
1734
  var model$19 = stringify(serializeByValueID(request.fatalError));
@@ -1846,7 +1856,7 @@ function startFlowing(request, destination) {
1846
1856
  }
1847
1857
  function abort(request, reason) {
1848
1858
  try {
1849
- request.status = 1;
1859
+ 0 === request.status && (request.status = 1);
1850
1860
  var abortableTasks = request.abortableTasks;
1851
1861
  if (0 < abortableTasks.size) {
1852
1862
  request.pendingChunks++;
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-d48603a5-20240813",
4
+ "version": "19.0.0-rc-49496d49-20240814",
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-d48603a5-20240813",
81
- "react-dom": "19.0.0-rc-d48603a5-20240813",
80
+ "react": "19.0.0-rc-49496d49-20240814",
81
+ "react-dom": "19.0.0-rc-49496d49-20240814",
82
82
  "webpack": "^5.59.0"
83
83
  },
84
84
  "dependencies": {