react-server-dom-webpack 19.0.0-rc-3edc000d-20240926 → 19.0.0-rc-d8c90fa4-20241001

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.
@@ -956,7 +956,8 @@
956
956
  key: key,
957
957
  owner: task.debugOwner
958
958
  };
959
- outlineModel(request, componentDebugInfo);
959
+ componentDebugInfo.props = props;
960
+ outlineComponentInfo(request, componentDebugInfo);
960
961
  emitDebugChunk(request, componentDebugID, componentDebugInfo);
961
962
  task.environmentName = componentEnv;
962
963
  }
@@ -1123,7 +1124,7 @@
1123
1124
  return (
1124
1125
  (type = task.implicitSlot),
1125
1126
  null === task.keyPath && (task.implicitSlot = !0),
1126
- (props = renderModelDestructive(
1127
+ (request = renderModelDestructive(
1127
1128
  request,
1128
1129
  task,
1129
1130
  emptyRoot,
@@ -1131,7 +1132,7 @@
1131
1132
  props.children
1132
1133
  )),
1133
1134
  (task.implicitSlot = type),
1134
- props
1135
+ request
1135
1136
  );
1136
1137
  if (
1137
1138
  null != type &&
@@ -1157,13 +1158,12 @@
1157
1158
  type._store.validated = 1;
1158
1159
  }
1159
1160
  } else return renderFunctionComponent(request, task, key, type, props);
1160
- request = key;
1161
- key = task.keyPath;
1162
- null === request
1163
- ? (request = key)
1164
- : null !== key && (request = key + "," + request);
1165
- props = [REACT_ELEMENT_TYPE, type, request, props, task.debugOwner];
1166
- task = task.implicitSlot && null !== request ? [props] : props;
1161
+ ref = task.keyPath;
1162
+ null === key ? (key = ref) : null !== ref && (key = ref + "," + key);
1163
+ null !== task.debugOwner &&
1164
+ outlineComponentInfo(request, task.debugOwner);
1165
+ request = [REACT_ELEMENT_TYPE, type, key, props, task.debugOwner];
1166
+ task = task.implicitSlot && null !== key ? [request] : request;
1167
1167
  return task;
1168
1168
  }
1169
1169
  function pingTask(request, task) {
@@ -1431,18 +1431,6 @@
1431
1431
  reader.read().then(progress).catch(error);
1432
1432
  return "$B" + newTask.id.toString(16);
1433
1433
  }
1434
- function isReactComponentInfo(value) {
1435
- return (
1436
- (("object" === typeof value.debugTask &&
1437
- null !== value.debugTask &&
1438
- "function" === typeof value.debugTask.run) ||
1439
- value.debugStack instanceof Error) &&
1440
- "undefined" === typeof value.stack &&
1441
- "string" === typeof value.name &&
1442
- "string" === typeof value.env &&
1443
- void 0 !== value.owner
1444
- );
1445
- }
1446
1434
  function renderModel(request, task, parent, key, value) {
1447
1435
  var prevKeyPath = task.keyPath,
1448
1436
  prevImplicitSlot = task.implicitSlot;
@@ -1629,6 +1617,7 @@
1629
1617
  if (value instanceof Set) return serializeSet(request, value);
1630
1618
  if ("function" === typeof FormData && value instanceof FormData)
1631
1619
  return serializeFormData(request, value);
1620
+ if (value instanceof Error) return serializeErrorValue(request, value);
1632
1621
  if (value instanceof ArrayBuffer)
1633
1622
  return serializeTypedArray(request, "A", new Uint8Array(value));
1634
1623
  if (value instanceof Int8Array)
@@ -1683,13 +1672,6 @@
1683
1672
  "Only plain objects, and a few built-ins, can be passed to Client Components from Server Components. Classes or null prototypes are not supported." +
1684
1673
  describeObjectForErrorMessage(parent, parentPropertyName)
1685
1674
  );
1686
- if (isReactComponentInfo(value))
1687
- return {
1688
- name: value.name,
1689
- env: value.env,
1690
- key: value.key,
1691
- owner: value.owner
1692
- };
1693
1675
  if ("Object" !== objectName(value))
1694
1676
  callWithDebugContextInDEV(request, task, function () {
1695
1677
  console.error(
@@ -1836,6 +1818,27 @@
1836
1818
  ? ((request.status = CLOSED), request.destination.destroy(error))
1837
1819
  : ((request.status = CLOSING), (request.fatalError = error));
1838
1820
  }
1821
+ function serializeErrorValue(request, error) {
1822
+ var env = (0, request.environmentName)();
1823
+ try {
1824
+ var message = String(error.message);
1825
+ var stack = filterStackTrace(request, error, 0);
1826
+ var errorEnv = error.environmentName;
1827
+ "string" === typeof errorEnv && (env = errorEnv);
1828
+ } catch (x) {
1829
+ (message =
1830
+ "An error occurred but serializing the error message failed."),
1831
+ (stack = []);
1832
+ }
1833
+ return (
1834
+ "$Z" +
1835
+ outlineModel(request, {
1836
+ message: message,
1837
+ stack: stack,
1838
+ env: env
1839
+ }).toString(16)
1840
+ );
1841
+ }
1839
1842
  function emitErrorChunk(request, id, digest, error) {
1840
1843
  var env = (0, request.environmentName)();
1841
1844
  try {
@@ -1868,7 +1871,7 @@
1868
1871
  request.completedRegularChunks.push(id);
1869
1872
  }
1870
1873
  function emitDebugChunk(request, id, debugInfo) {
1871
- var counter = { objectCount: 0 };
1874
+ var counter = { objectLimit: 500 };
1872
1875
  debugInfo = stringify(debugInfo, function (parentPropertyName, value) {
1873
1876
  return renderConsoleValue(
1874
1877
  request,
@@ -1881,6 +1884,32 @@
1881
1884
  id = serializeRowHeader("D", id) + debugInfo + "\n";
1882
1885
  request.completedRegularChunks.push(id);
1883
1886
  }
1887
+ function outlineComponentInfo(request, componentInfo) {
1888
+ if (!request.writtenObjects.has(componentInfo)) {
1889
+ null != componentInfo.owner &&
1890
+ outlineComponentInfo(request, componentInfo.owner);
1891
+ var objectLimit = 10;
1892
+ null != componentInfo.stack &&
1893
+ (objectLimit += componentInfo.stack.length);
1894
+ objectLimit = { objectLimit: objectLimit };
1895
+ var componentDebugInfo = {
1896
+ name: componentInfo.name,
1897
+ env: componentInfo.env,
1898
+ key: componentInfo.key,
1899
+ owner: componentInfo.owner
1900
+ };
1901
+ componentDebugInfo.props = componentInfo.props;
1902
+ objectLimit = outlineConsoleValue(
1903
+ request,
1904
+ objectLimit,
1905
+ componentDebugInfo
1906
+ );
1907
+ request.writtenObjects.set(
1908
+ componentInfo,
1909
+ serializeByValueID(objectLimit)
1910
+ );
1911
+ }
1912
+ }
1884
1913
  function emitTypedArrayChunk(request, id, tag, typedArray) {
1885
1914
  request.pendingChunks++;
1886
1915
  typedArray = new Uint8Array(
@@ -1924,11 +1953,25 @@
1924
1953
  ((parent = request.temporaryReferences.get(value)), void 0 !== parent)
1925
1954
  )
1926
1955
  return "$T" + parent;
1927
- if (500 < counter.objectCount) return "$Y";
1928
- counter.objectCount++;
1929
1956
  parent = request.writtenObjects.get(value);
1957
+ if (void 0 !== parent) return parent;
1958
+ if (0 >= counter.objectLimit) return "$Y";
1959
+ counter.objectLimit--;
1960
+ switch (value.$$typeof) {
1961
+ case REACT_ELEMENT_TYPE:
1962
+ return (
1963
+ null != value._owner &&
1964
+ outlineComponentInfo(request, value._owner),
1965
+ [
1966
+ REACT_ELEMENT_TYPE,
1967
+ value.type,
1968
+ value.key,
1969
+ value.props,
1970
+ value._owner
1971
+ ]
1972
+ );
1973
+ }
1930
1974
  if ("function" === typeof value.then) {
1931
- if (void 0 !== parent) return parent;
1932
1975
  switch (value.status) {
1933
1976
  case "fulfilled":
1934
1977
  return (
@@ -1946,20 +1989,19 @@
1946
1989
  }
1947
1990
  return "$@";
1948
1991
  }
1949
- return void 0 !== parent
1950
- ? parent
1951
- : isArrayImpl(value)
1952
- ? value
1953
- : value instanceof Map
1992
+ return isArrayImpl(value)
1993
+ ? value
1994
+ : value instanceof Map
1995
+ ? ((value = Array.from(value)),
1996
+ "$Q" + outlineConsoleValue(request, counter, value).toString(16))
1997
+ : value instanceof Set
1954
1998
  ? ((value = Array.from(value)),
1955
- "$Q" +
1999
+ "$W" +
1956
2000
  outlineConsoleValue(request, counter, value).toString(16))
1957
- : value instanceof Set
1958
- ? ((value = Array.from(value)),
1959
- "$W" +
1960
- outlineConsoleValue(request, counter, value).toString(16))
1961
- : "function" === typeof FormData && value instanceof FormData
1962
- ? serializeFormData(request, value)
2001
+ : "function" === typeof FormData && value instanceof FormData
2002
+ ? serializeFormData(request, value)
2003
+ : value instanceof Error
2004
+ ? serializeErrorValue(request, value)
1963
2005
  : value instanceof ArrayBuffer
1964
2006
  ? serializeTypedArray(request, "A", new Uint8Array(value))
1965
2007
  : value instanceof Int8Array
@@ -2003,14 +2045,7 @@
2003
2045
  ? serializeBlob(request, value)
2004
2046
  : getIteratorFn(value)
2005
2047
  ? Array.from(value)
2006
- : isReactComponentInfo(value)
2007
- ? {
2008
- name: value.name,
2009
- env: value.env,
2010
- key: value.key,
2011
- owner: value.owner
2012
- }
2013
- : value;
2048
+ : value;
2014
2049
  }
2015
2050
  if ("string" === typeof value)
2016
2051
  return "Z" === value[value.length - 1] && originalValue instanceof Date
@@ -2055,7 +2090,10 @@
2055
2090
  value
2056
2091
  );
2057
2092
  } catch (x) {
2058
- return "unknown value";
2093
+ return (
2094
+ "Unknown Value: React could not send it from the server.\n" +
2095
+ x.message
2096
+ );
2059
2097
  }
2060
2098
  });
2061
2099
  request.pendingChunks++;
@@ -2072,8 +2110,9 @@
2072
2110
  stackTrace,
2073
2111
  args
2074
2112
  ) {
2075
- var counter = { objectCount: 0 },
2076
- env = (0, request.environmentName)();
2113
+ var counter = { objectLimit: 500 };
2114
+ null != owner && outlineComponentInfo(request, owner);
2115
+ var env = (0, request.environmentName)();
2077
2116
  methodName = [methodName, stackTrace, owner, env];
2078
2117
  methodName.push.apply(methodName, args);
2079
2118
  args = stringify(methodName, function (parentPropertyName, value) {
@@ -2086,7 +2125,10 @@
2086
2125
  value
2087
2126
  );
2088
2127
  } catch (x) {
2089
- return "unknown value";
2128
+ return (
2129
+ "Unknown Value: React could not send it from the server.\n" +
2130
+ x.message
2131
+ );
2090
2132
  }
2091
2133
  });
2092
2134
  id = serializeRowHeader("W", id) + args + "\n";
@@ -2096,7 +2138,7 @@
2096
2138
  for (var i = 0; i < debugInfo.length; i++)
2097
2139
  request.pendingChunks++,
2098
2140
  "string" === typeof debugInfo[i].name &&
2099
- outlineModel(request, debugInfo[i]),
2141
+ outlineComponentInfo(request, debugInfo[i]),
2100
2142
  emitDebugChunk(request, id, debugInfo[i]);
2101
2143
  }
2102
2144
  function emitChunk(request, task, value) {
@@ -1477,6 +1477,7 @@ function renderModelDestructive(
1477
1477
  (value = Array.from(value.entries())),
1478
1478
  "$K" + outlineModel(request, value).toString(16)
1479
1479
  );
1480
+ if (value instanceof Error) return "$Z";
1480
1481
  if (value instanceof ArrayBuffer)
1481
1482
  return serializeTypedArray(request, "A", new Uint8Array(value));
1482
1483
  if (value instanceof Int8Array)
@@ -2742,12 +2743,12 @@ exports.decodeReplyFromBusboy = function (busboyStream, webpackMap, options) {
2742
2743
  "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."
2743
2744
  );
2744
2745
  pendingFiles++;
2745
- var JSCompiler_object_inline_chunks_212 = [];
2746
+ var JSCompiler_object_inline_chunks_216 = [];
2746
2747
  value.on("data", function (chunk) {
2747
- JSCompiler_object_inline_chunks_212.push(chunk);
2748
+ JSCompiler_object_inline_chunks_216.push(chunk);
2748
2749
  });
2749
2750
  value.on("end", function () {
2750
- var blob = new Blob(JSCompiler_object_inline_chunks_212, {
2751
+ var blob = new Blob(JSCompiler_object_inline_chunks_216, {
2751
2752
  type: mimeType
2752
2753
  });
2753
2754
  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-rc-3edc000d-20240926",
4
+ "version": "19.0.0-rc-d8c90fa4-20241001",
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.0.0-rc-3edc000d-20240926",
103
- "react-dom": "19.0.0-rc-3edc000d-20240926",
102
+ "react": "19.0.0-rc-d8c90fa4-20241001",
103
+ "react-dom": "19.0.0-rc-d8c90fa4-20241001",
104
104
  "webpack": "^5.59.0"
105
105
  },
106
106
  "dependencies": {