react-server-dom-webpack 19.2.0-canary-408d055a-20250430 → 19.2.0-canary-e9db3cc2-20250501

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.
@@ -1051,6 +1051,18 @@ function renderFragment(request, task, children) {
1051
1051
  task.implicitSlot ? [request] : request)
1052
1052
  : children;
1053
1053
  }
1054
+ var serializedSize = 0;
1055
+ function deferTask(request, task) {
1056
+ task = createTask(
1057
+ request,
1058
+ task.model,
1059
+ task.keyPath,
1060
+ task.implicitSlot,
1061
+ request.abortableTasks
1062
+ );
1063
+ pingTask(request, task);
1064
+ return "$L" + task.id.toString(16);
1065
+ }
1054
1066
  function renderElement(request, task, type, key, ref, props) {
1055
1067
  if (null !== ref && void 0 !== ref)
1056
1068
  throw Error(
@@ -1327,6 +1339,7 @@ function renderModelDestructive(
1327
1339
  value
1328
1340
  ) {
1329
1341
  task.model = value;
1342
+ serializedSize += parentPropertyName.length;
1330
1343
  if (value === REACT_ELEMENT_TYPE) return "$";
1331
1344
  if (null === value) return null;
1332
1345
  if ("object" === typeof value) {
@@ -1346,6 +1359,7 @@ function renderModelDestructive(
1346
1359
  ((elementReference = parent + ":" + parentPropertyName),
1347
1360
  writtenObjects.set(value, elementReference)));
1348
1361
  }
1362
+ if (3200 < serializedSize) return deferTask(request, task);
1349
1363
  parentPropertyName = value.props;
1350
1364
  parent = parentPropertyName.ref;
1351
1365
  request = renderElement(
@@ -1363,6 +1377,7 @@ function renderModelDestructive(
1363
1377
  writtenObjects.set(request, elementReference));
1364
1378
  return request;
1365
1379
  case REACT_LAZY_TYPE:
1380
+ if (3200 < serializedSize) return deferTask(request, task);
1366
1381
  task.thenableState = null;
1367
1382
  parentPropertyName = value._init;
1368
1383
  value = parentPropertyName(value._payload);
@@ -1512,6 +1527,7 @@ function renderModelDestructive(
1512
1527
  return value;
1513
1528
  }
1514
1529
  if ("string" === typeof value) {
1530
+ serializedSize += value.length;
1515
1531
  if (
1516
1532
  "Z" === value[value.length - 1] &&
1517
1533
  parent[parentPropertyName] instanceof Date
@@ -1681,36 +1697,43 @@ function emitTextChunk(request, id, text) {
1681
1697
  }
1682
1698
  function emitChunk(request, task, value) {
1683
1699
  var id = task.id;
1684
- "string" === typeof value && null !== byteLengthOfChunk
1685
- ? emitTextChunk(request, id, value)
1686
- : value instanceof ArrayBuffer
1687
- ? emitTypedArrayChunk(request, id, "A", new Uint8Array(value))
1688
- : value instanceof Int8Array
1689
- ? emitTypedArrayChunk(request, id, "O", value)
1690
- : value instanceof Uint8Array
1691
- ? emitTypedArrayChunk(request, id, "o", value)
1692
- : value instanceof Uint8ClampedArray
1693
- ? emitTypedArrayChunk(request, id, "U", value)
1694
- : value instanceof Int16Array
1695
- ? emitTypedArrayChunk(request, id, "S", value)
1696
- : value instanceof Uint16Array
1697
- ? emitTypedArrayChunk(request, id, "s", value)
1698
- : value instanceof Int32Array
1699
- ? emitTypedArrayChunk(request, id, "L", value)
1700
- : value instanceof Uint32Array
1701
- ? emitTypedArrayChunk(request, id, "l", value)
1702
- : value instanceof Float32Array
1703
- ? emitTypedArrayChunk(request, id, "G", value)
1704
- : value instanceof Float64Array
1705
- ? emitTypedArrayChunk(request, id, "g", value)
1706
- : value instanceof BigInt64Array
1707
- ? emitTypedArrayChunk(request, id, "M", value)
1708
- : value instanceof BigUint64Array
1709
- ? emitTypedArrayChunk(request, id, "m", value)
1710
- : value instanceof DataView
1711
- ? emitTypedArrayChunk(request, id, "V", value)
1712
- : ((value = stringify(value, task.toJSON)),
1713
- emitModelChunk(request, task.id, value));
1700
+ if ("string" === typeof value && null !== byteLengthOfChunk)
1701
+ emitTextChunk(request, id, value);
1702
+ else if (value instanceof ArrayBuffer)
1703
+ emitTypedArrayChunk(request, id, "A", new Uint8Array(value));
1704
+ else if (value instanceof Int8Array)
1705
+ emitTypedArrayChunk(request, id, "O", value);
1706
+ else if (value instanceof Uint8Array)
1707
+ emitTypedArrayChunk(request, id, "o", value);
1708
+ else if (value instanceof Uint8ClampedArray)
1709
+ emitTypedArrayChunk(request, id, "U", value);
1710
+ else if (value instanceof Int16Array)
1711
+ emitTypedArrayChunk(request, id, "S", value);
1712
+ else if (value instanceof Uint16Array)
1713
+ emitTypedArrayChunk(request, id, "s", value);
1714
+ else if (value instanceof Int32Array)
1715
+ emitTypedArrayChunk(request, id, "L", value);
1716
+ else if (value instanceof Uint32Array)
1717
+ emitTypedArrayChunk(request, id, "l", value);
1718
+ else if (value instanceof Float32Array)
1719
+ emitTypedArrayChunk(request, id, "G", value);
1720
+ else if (value instanceof Float64Array)
1721
+ emitTypedArrayChunk(request, id, "g", value);
1722
+ else if (value instanceof BigInt64Array)
1723
+ emitTypedArrayChunk(request, id, "M", value);
1724
+ else if (value instanceof BigUint64Array)
1725
+ emitTypedArrayChunk(request, id, "m", value);
1726
+ else if (value instanceof DataView)
1727
+ emitTypedArrayChunk(request, id, "V", value);
1728
+ else {
1729
+ id = serializedSize;
1730
+ try {
1731
+ var json = stringify(value, task.toJSON);
1732
+ emitModelChunk(request, task.id, json);
1733
+ } finally {
1734
+ serializedSize = id;
1735
+ }
1736
+ }
1714
1737
  }
1715
1738
  function erroredTask(request, task, error) {
1716
1739
  task.status = 4;
@@ -1276,6 +1276,20 @@
1276
1276
  getAsyncIterator = getAsyncIterator.call(children);
1277
1277
  return serializeAsyncIterable(request, task, children, getAsyncIterator);
1278
1278
  }
1279
+ function deferTask(request, task) {
1280
+ task = createTask(
1281
+ request,
1282
+ task.model,
1283
+ task.keyPath,
1284
+ task.implicitSlot,
1285
+ request.abortableTasks,
1286
+ task.debugOwner,
1287
+ task.debugStack,
1288
+ task.debugTask
1289
+ );
1290
+ pingTask(request, task);
1291
+ return serializeLazyID(task.id);
1292
+ }
1279
1293
  function outlineTask(request, task) {
1280
1294
  task = createTask(
1281
1295
  request,
@@ -1290,7 +1304,7 @@
1290
1304
  retryTask(request, task);
1291
1305
  return task.status === COMPLETED
1292
1306
  ? serializeByValueID(task.id)
1293
- : "$L" + task.id.toString(16);
1307
+ : serializeLazyID(task.id);
1294
1308
  }
1295
1309
  function renderElement(request, task, type, key, ref, props, validated) {
1296
1310
  if (null !== ref && void 0 !== ref)
@@ -1479,6 +1493,9 @@
1479
1493
  function serializeByValueID(id) {
1480
1494
  return "$" + id.toString(16);
1481
1495
  }
1496
+ function serializeLazyID(id) {
1497
+ return "$L" + id.toString(16);
1498
+ }
1482
1499
  function serializeNumber(number) {
1483
1500
  return Number.isFinite(number)
1484
1501
  ? 0 === number && -Infinity === 1 / number
@@ -1507,7 +1524,7 @@
1507
1524
  existingId = writtenClientReferences.get(clientReferenceKey);
1508
1525
  if (void 0 !== existingId)
1509
1526
  return parent[0] === REACT_ELEMENT_TYPE && "1" === parentPropertyName
1510
- ? "$L" + existingId.toString(16)
1527
+ ? serializeLazyID(existingId)
1511
1528
  : serializeByValueID(existingId);
1512
1529
  try {
1513
1530
  var config = request.bundlerConfig,
@@ -1544,7 +1561,7 @@
1544
1561
  request.completedImportChunks.push(processedChunk);
1545
1562
  writtenClientReferences.set(clientReferenceKey, importId);
1546
1563
  return parent[0] === REACT_ELEMENT_TYPE && "1" === parentPropertyName
1547
- ? "$L" + importId.toString(16)
1564
+ ? serializeLazyID(importId)
1548
1565
  : serializeByValueID(importId);
1549
1566
  } catch (x) {
1550
1567
  return (
@@ -1684,7 +1701,7 @@
1684
1701
  return (
1685
1702
  (task.status = ABORTED),
1686
1703
  (task = request.fatalError),
1687
- parent ? "$L" + task.toString(16) : serializeByValueID(task)
1704
+ parent ? serializeLazyID(task) : serializeByValueID(task)
1688
1705
  );
1689
1706
  key =
1690
1707
  thrownValue === SuspenseException
@@ -1712,7 +1729,7 @@
1712
1729
  (task.keyPath = prevKeyPath),
1713
1730
  (task.implicitSlot = prevImplicitSlot),
1714
1731
  parent
1715
- ? "$L" + request.id.toString(16)
1732
+ ? serializeLazyID(request.id)
1716
1733
  : serializeByValueID(request.id)
1717
1734
  );
1718
1735
  task.keyPath = prevKeyPath;
@@ -1722,7 +1739,7 @@
1722
1739
  task = logRecoverableError(request, key, task);
1723
1740
  emitErrorChunk(request, prevKeyPath, task, key);
1724
1741
  return parent
1725
- ? "$L" + prevKeyPath.toString(16)
1742
+ ? serializeLazyID(prevKeyPath)
1726
1743
  : serializeByValueID(prevKeyPath);
1727
1744
  }
1728
1745
  }
@@ -1734,6 +1751,7 @@
1734
1751
  value
1735
1752
  ) {
1736
1753
  task.model = value;
1754
+ serializedSize += parentPropertyName.length;
1737
1755
  if (value === REACT_ELEMENT_TYPE) return "$";
1738
1756
  if (null === value) return null;
1739
1757
  if ("object" === typeof value) {
@@ -1754,6 +1772,7 @@
1754
1772
  _existingReference + ":" + parentPropertyName),
1755
1773
  _writtenObjects.set(value, elementReference)));
1756
1774
  }
1775
+ if (serializedSize > MAX_ROW_SIZE) return deferTask(request, task);
1757
1776
  if ((_existingReference = value._debugInfo)) {
1758
1777
  if (null === debugID) return outlineTask(request, task);
1759
1778
  forwardDebugInfo(request, debugID, _existingReference);
@@ -1779,6 +1798,7 @@
1779
1798
  _writtenObjects.set(request, elementReference));
1780
1799
  return request;
1781
1800
  case REACT_LAZY_TYPE:
1801
+ if (serializedSize > MAX_ROW_SIZE) return deferTask(request, task);
1782
1802
  task.thenableState = null;
1783
1803
  elementReference = callLazyInitInDEV(value);
1784
1804
  if (request.status === ABORTING) throw null;
@@ -1944,14 +1964,17 @@
1944
1964
  return value;
1945
1965
  }
1946
1966
  if ("string" === typeof value)
1947
- return "Z" === value[value.length - 1] &&
1967
+ return (
1968
+ (serializedSize += value.length),
1969
+ "Z" === value[value.length - 1] &&
1948
1970
  parent[parentPropertyName] instanceof Date
1949
- ? "$D" + value
1950
- : 1024 <= value.length && null !== byteLengthOfChunk
1951
- ? serializeLargeTextString(request, value)
1952
- : "$" === value[0]
1953
- ? "$" + value
1954
- : value;
1971
+ ? "$D" + value
1972
+ : 1024 <= value.length && null !== byteLengthOfChunk
1973
+ ? serializeLargeTextString(request, value)
1974
+ : "$" === value[0]
1975
+ ? "$" + value
1976
+ : value
1977
+ );
1955
1978
  if ("boolean" === typeof value) return value;
1956
1979
  if ("number" === typeof value) return serializeNumber(value);
1957
1980
  if ("undefined" === typeof value) return "$undefined";
@@ -2446,36 +2469,43 @@
2446
2469
  }
2447
2470
  function emitChunk(request, task, value) {
2448
2471
  var id = task.id;
2449
- "string" === typeof value && null !== byteLengthOfChunk
2450
- ? emitTextChunk(request, id, value)
2451
- : value instanceof ArrayBuffer
2452
- ? emitTypedArrayChunk(request, id, "A", new Uint8Array(value))
2453
- : value instanceof Int8Array
2454
- ? emitTypedArrayChunk(request, id, "O", value)
2455
- : value instanceof Uint8Array
2456
- ? emitTypedArrayChunk(request, id, "o", value)
2457
- : value instanceof Uint8ClampedArray
2458
- ? emitTypedArrayChunk(request, id, "U", value)
2459
- : value instanceof Int16Array
2460
- ? emitTypedArrayChunk(request, id, "S", value)
2461
- : value instanceof Uint16Array
2462
- ? emitTypedArrayChunk(request, id, "s", value)
2463
- : value instanceof Int32Array
2464
- ? emitTypedArrayChunk(request, id, "L", value)
2465
- : value instanceof Uint32Array
2466
- ? emitTypedArrayChunk(request, id, "l", value)
2467
- : value instanceof Float32Array
2468
- ? emitTypedArrayChunk(request, id, "G", value)
2469
- : value instanceof Float64Array
2470
- ? emitTypedArrayChunk(request, id, "g", value)
2471
- : value instanceof BigInt64Array
2472
- ? emitTypedArrayChunk(request, id, "M", value)
2473
- : value instanceof BigUint64Array
2474
- ? emitTypedArrayChunk(request, id, "m", value)
2475
- : value instanceof DataView
2476
- ? emitTypedArrayChunk(request, id, "V", value)
2477
- : ((value = stringify(value, task.toJSON)),
2478
- emitModelChunk(request, task.id, value));
2472
+ if ("string" === typeof value && null !== byteLengthOfChunk)
2473
+ emitTextChunk(request, id, value);
2474
+ else if (value instanceof ArrayBuffer)
2475
+ emitTypedArrayChunk(request, id, "A", new Uint8Array(value));
2476
+ else if (value instanceof Int8Array)
2477
+ emitTypedArrayChunk(request, id, "O", value);
2478
+ else if (value instanceof Uint8Array)
2479
+ emitTypedArrayChunk(request, id, "o", value);
2480
+ else if (value instanceof Uint8ClampedArray)
2481
+ emitTypedArrayChunk(request, id, "U", value);
2482
+ else if (value instanceof Int16Array)
2483
+ emitTypedArrayChunk(request, id, "S", value);
2484
+ else if (value instanceof Uint16Array)
2485
+ emitTypedArrayChunk(request, id, "s", value);
2486
+ else if (value instanceof Int32Array)
2487
+ emitTypedArrayChunk(request, id, "L", value);
2488
+ else if (value instanceof Uint32Array)
2489
+ emitTypedArrayChunk(request, id, "l", value);
2490
+ else if (value instanceof Float32Array)
2491
+ emitTypedArrayChunk(request, id, "G", value);
2492
+ else if (value instanceof Float64Array)
2493
+ emitTypedArrayChunk(request, id, "g", value);
2494
+ else if (value instanceof BigInt64Array)
2495
+ emitTypedArrayChunk(request, id, "M", value);
2496
+ else if (value instanceof BigUint64Array)
2497
+ emitTypedArrayChunk(request, id, "m", value);
2498
+ else if (value instanceof DataView)
2499
+ emitTypedArrayChunk(request, id, "V", value);
2500
+ else {
2501
+ id = serializedSize;
2502
+ try {
2503
+ var json = stringify(value, task.toJSON);
2504
+ emitModelChunk(request, task.id, json);
2505
+ } finally {
2506
+ serializedSize = id;
2507
+ }
2508
+ }
2479
2509
  }
2480
2510
  function erroredTask(request, task, error) {
2481
2511
  task.status = ERRORED$1;
@@ -3947,6 +3977,8 @@
3947
3977
  PRERENDER = 21,
3948
3978
  currentRequest = null,
3949
3979
  debugID = null,
3980
+ serializedSize = 0,
3981
+ MAX_ROW_SIZE = 3200,
3950
3982
  modelRoot = !1,
3951
3983
  emptyRoot = {},
3952
3984
  chunkCache = new Map(),
@@ -1067,6 +1067,18 @@ function renderFragment(request, task, children) {
1067
1067
  task.implicitSlot ? [request] : request)
1068
1068
  : children;
1069
1069
  }
1070
+ var serializedSize = 0;
1071
+ function deferTask(request, task) {
1072
+ task = createTask(
1073
+ request,
1074
+ task.model,
1075
+ task.keyPath,
1076
+ task.implicitSlot,
1077
+ request.abortableTasks
1078
+ );
1079
+ pingTask(request, task);
1080
+ return "$L" + task.id.toString(16);
1081
+ }
1070
1082
  function renderElement(request, task, type, key, ref, props) {
1071
1083
  if (null !== ref && void 0 !== ref)
1072
1084
  throw Error(
@@ -1341,6 +1353,7 @@ function renderModelDestructive(
1341
1353
  value
1342
1354
  ) {
1343
1355
  task.model = value;
1356
+ serializedSize += parentPropertyName.length;
1344
1357
  if (value === REACT_ELEMENT_TYPE) return "$";
1345
1358
  if (null === value) return null;
1346
1359
  if ("object" === typeof value) {
@@ -1360,6 +1373,7 @@ function renderModelDestructive(
1360
1373
  ((elementReference = parent + ":" + parentPropertyName),
1361
1374
  writtenObjects.set(value, elementReference)));
1362
1375
  }
1376
+ if (3200 < serializedSize) return deferTask(request, task);
1363
1377
  parentPropertyName = value.props;
1364
1378
  parent = parentPropertyName.ref;
1365
1379
  request = renderElement(
@@ -1377,6 +1391,7 @@ function renderModelDestructive(
1377
1391
  writtenObjects.set(request, elementReference));
1378
1392
  return request;
1379
1393
  case REACT_LAZY_TYPE:
1394
+ if (3200 < serializedSize) return deferTask(request, task);
1380
1395
  task.thenableState = null;
1381
1396
  parentPropertyName = value._init;
1382
1397
  value = parentPropertyName(value._payload);
@@ -1526,6 +1541,7 @@ function renderModelDestructive(
1526
1541
  return value;
1527
1542
  }
1528
1543
  if ("string" === typeof value) {
1544
+ serializedSize += value.length;
1529
1545
  if (
1530
1546
  "Z" === value[value.length - 1] &&
1531
1547
  parent[parentPropertyName] instanceof Date
@@ -1686,36 +1702,43 @@ function emitTextChunk(request, id, text) {
1686
1702
  }
1687
1703
  function emitChunk(request, task, value) {
1688
1704
  var id = task.id;
1689
- "string" === typeof value && null !== byteLengthOfChunk
1690
- ? emitTextChunk(request, id, value)
1691
- : value instanceof ArrayBuffer
1692
- ? emitTypedArrayChunk(request, id, "A", new Uint8Array(value))
1693
- : value instanceof Int8Array
1694
- ? emitTypedArrayChunk(request, id, "O", value)
1695
- : value instanceof Uint8Array
1696
- ? emitTypedArrayChunk(request, id, "o", value)
1697
- : value instanceof Uint8ClampedArray
1698
- ? emitTypedArrayChunk(request, id, "U", value)
1699
- : value instanceof Int16Array
1700
- ? emitTypedArrayChunk(request, id, "S", value)
1701
- : value instanceof Uint16Array
1702
- ? emitTypedArrayChunk(request, id, "s", value)
1703
- : value instanceof Int32Array
1704
- ? emitTypedArrayChunk(request, id, "L", value)
1705
- : value instanceof Uint32Array
1706
- ? emitTypedArrayChunk(request, id, "l", value)
1707
- : value instanceof Float32Array
1708
- ? emitTypedArrayChunk(request, id, "G", value)
1709
- : value instanceof Float64Array
1710
- ? emitTypedArrayChunk(request, id, "g", value)
1711
- : value instanceof BigInt64Array
1712
- ? emitTypedArrayChunk(request, id, "M", value)
1713
- : value instanceof BigUint64Array
1714
- ? emitTypedArrayChunk(request, id, "m", value)
1715
- : value instanceof DataView
1716
- ? emitTypedArrayChunk(request, id, "V", value)
1717
- : ((value = stringify(value, task.toJSON)),
1718
- emitModelChunk(request, task.id, value));
1705
+ if ("string" === typeof value && null !== byteLengthOfChunk)
1706
+ emitTextChunk(request, id, value);
1707
+ else if (value instanceof ArrayBuffer)
1708
+ emitTypedArrayChunk(request, id, "A", new Uint8Array(value));
1709
+ else if (value instanceof Int8Array)
1710
+ emitTypedArrayChunk(request, id, "O", value);
1711
+ else if (value instanceof Uint8Array)
1712
+ emitTypedArrayChunk(request, id, "o", value);
1713
+ else if (value instanceof Uint8ClampedArray)
1714
+ emitTypedArrayChunk(request, id, "U", value);
1715
+ else if (value instanceof Int16Array)
1716
+ emitTypedArrayChunk(request, id, "S", value);
1717
+ else if (value instanceof Uint16Array)
1718
+ emitTypedArrayChunk(request, id, "s", value);
1719
+ else if (value instanceof Int32Array)
1720
+ emitTypedArrayChunk(request, id, "L", value);
1721
+ else if (value instanceof Uint32Array)
1722
+ emitTypedArrayChunk(request, id, "l", value);
1723
+ else if (value instanceof Float32Array)
1724
+ emitTypedArrayChunk(request, id, "G", value);
1725
+ else if (value instanceof Float64Array)
1726
+ emitTypedArrayChunk(request, id, "g", value);
1727
+ else if (value instanceof BigInt64Array)
1728
+ emitTypedArrayChunk(request, id, "M", value);
1729
+ else if (value instanceof BigUint64Array)
1730
+ emitTypedArrayChunk(request, id, "m", value);
1731
+ else if (value instanceof DataView)
1732
+ emitTypedArrayChunk(request, id, "V", value);
1733
+ else {
1734
+ id = serializedSize;
1735
+ try {
1736
+ var json = stringify(value, task.toJSON);
1737
+ emitModelChunk(request, task.id, json);
1738
+ } finally {
1739
+ serializedSize = id;
1740
+ }
1741
+ }
1719
1742
  }
1720
1743
  function erroredTask(request, task, error) {
1721
1744
  task.status = 4;