react-server-dom-webpack 19.0.0-rc-6230622a1a-20240610 → 19.0.0-rc-f3e09d6328-20240612

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,30 @@
11
11
  "use strict";
12
12
  var ReactDOM = require("react-dom"),
13
13
  React = require("react"),
14
+ channel = new MessageChannel(),
15
+ taskQueue = [];
16
+ channel.port1.onmessage = function () {
17
+ var task = taskQueue.shift();
18
+ task && task();
19
+ };
20
+ function scheduleWork(callback) {
21
+ taskQueue.push(callback);
22
+ channel.port2.postMessage(null);
23
+ }
24
+ function handleErrorInNextTick(error) {
25
+ setTimeout(function () {
26
+ throw error;
27
+ });
28
+ }
29
+ var LocalPromise = Promise,
30
+ scheduleMicrotask =
31
+ "function" === typeof queueMicrotask
32
+ ? queueMicrotask
33
+ : function (callback) {
34
+ LocalPromise.resolve(null)
35
+ .then(callback)
36
+ .catch(handleErrorInNextTick);
37
+ },
14
38
  currentView = null,
15
39
  writtenBytes = 0;
16
40
  function writeChunkAndReturn(destination, chunk) {
@@ -670,12 +694,13 @@ if (!ReactSharedInternalsServer)
670
694
  'The "react" package in this environment is not configured correctly. The "react-server" condition must be enabled in any environment that runs React Server Components.'
671
695
  );
672
696
  var ObjectPrototype = Object.prototype,
673
- stringify = JSON.stringify;
697
+ stringify = JSON.stringify,
698
+ AbortSigil = {};
674
699
  function defaultErrorHandler(error) {
675
700
  console.error(error);
676
701
  }
677
702
  function defaultPostponeHandler() {}
678
- function createRequest(
703
+ function RequestInstance(
679
704
  model,
680
705
  bundlerConfig,
681
706
  onError,
@@ -693,37 +718,32 @@ function createRequest(
693
718
  var abortSet = new Set();
694
719
  environmentName = [];
695
720
  var hints = new Set();
696
- bundlerConfig = {
697
- status: 0,
698
- flushScheduled: !1,
699
- fatalError: null,
700
- destination: null,
701
- bundlerConfig: bundlerConfig,
702
- cache: new Map(),
703
- nextChunkId: 0,
704
- pendingChunks: 0,
705
- hints: hints,
706
- abortListeners: new Set(),
707
- abortableTasks: abortSet,
708
- pingedTasks: environmentName,
709
- completedImportChunks: [],
710
- completedHintChunks: [],
711
- completedRegularChunks: [],
712
- completedErrorChunks: [],
713
- writtenSymbols: new Map(),
714
- writtenClientReferences: new Map(),
715
- writtenServerReferences: new Map(),
716
- writtenObjects: new WeakMap(),
717
- temporaryReferences: temporaryReferences,
718
- identifierPrefix: identifierPrefix || "",
719
- identifierCount: 1,
720
- taintCleanupQueue: [],
721
- onError: void 0 === onError ? defaultErrorHandler : onError,
722
- onPostpone: void 0 === onPostpone ? defaultPostponeHandler : onPostpone
723
- };
724
- model = createTask(bundlerConfig, model, null, !1, abortSet);
721
+ this.status = 0;
722
+ this.flushScheduled = !1;
723
+ this.destination = this.fatalError = null;
724
+ this.bundlerConfig = bundlerConfig;
725
+ this.cache = new Map();
726
+ this.pendingChunks = this.nextChunkId = 0;
727
+ this.hints = hints;
728
+ this.abortListeners = new Set();
729
+ this.abortableTasks = abortSet;
730
+ this.pingedTasks = environmentName;
731
+ this.completedImportChunks = [];
732
+ this.completedHintChunks = [];
733
+ this.completedRegularChunks = [];
734
+ this.completedErrorChunks = [];
735
+ this.writtenSymbols = new Map();
736
+ this.writtenClientReferences = new Map();
737
+ this.writtenServerReferences = new Map();
738
+ this.writtenObjects = new WeakMap();
739
+ this.temporaryReferences = temporaryReferences;
740
+ this.identifierPrefix = identifierPrefix || "";
741
+ this.identifierCount = 1;
742
+ this.taintCleanupQueue = [];
743
+ this.onError = void 0 === onError ? defaultErrorHandler : onError;
744
+ this.onPostpone = void 0 === onPostpone ? defaultPostponeHandler : onPostpone;
745
+ model = createTask(this, model, null, !1, abortSet);
725
746
  environmentName.push(model);
726
- return bundlerConfig;
727
747
  }
728
748
  var currentRequest = null;
729
749
  function serializeThenable(request, task, thenable) {
@@ -746,6 +766,14 @@ function serializeThenable(request, task, thenable) {
746
766
  newTask.id
747
767
  );
748
768
  default:
769
+ if (1 === request.status)
770
+ return (
771
+ (newTask.status = 3),
772
+ (task = stringify(serializeByValueID(request.fatalError))),
773
+ emitModelChunk(request, newTask.id, task),
774
+ request.abortableTasks.delete(newTask),
775
+ newTask.id
776
+ );
749
777
  "string" !== typeof thenable.status &&
750
778
  ((thenable.status = "pending"),
751
779
  thenable.then(
@@ -932,6 +960,7 @@ function renderFunctionComponent(request, task, key, Component, props) {
932
960
  thenableIndexCounter = 0;
933
961
  thenableState = prevThenableState;
934
962
  Component = Component(props, void 0);
963
+ if (1 === request.status) throw AbortSigil;
935
964
  if (
936
965
  "object" === typeof Component &&
937
966
  null !== Component &&
@@ -1029,6 +1058,7 @@ function renderElement(request, task, type, key, ref, props) {
1029
1058
  case REACT_LAZY_TYPE:
1030
1059
  var init = type._init;
1031
1060
  type = init(type._payload);
1061
+ if (1 === request.status) throw AbortSigil;
1032
1062
  return renderElement(request, task, type, key, ref, props);
1033
1063
  case REACT_FORWARD_REF_TYPE:
1034
1064
  return renderFunctionComponent(request, task, key, type.render, props);
@@ -1045,7 +1075,9 @@ function pingTask(request, task) {
1045
1075
  pingedTasks.push(task);
1046
1076
  1 === pingedTasks.length &&
1047
1077
  ((request.flushScheduled = null !== request.destination),
1048
- performWork(request));
1078
+ scheduleMicrotask(function () {
1079
+ return performWork(request);
1080
+ }));
1049
1081
  }
1050
1082
  function createTask(request, model, keyPath, implicitSlot, abortSet) {
1051
1083
  request.pendingChunks++;
@@ -1077,50 +1109,60 @@ function createTask(request, model, keyPath, implicitSlot, abortSet) {
1077
1109
  );
1078
1110
  } catch (thrownValue) {
1079
1111
  if (
1080
- ((parentPropertyName =
1112
+ ((parentPropertyName = task.model),
1113
+ (parentPropertyName =
1114
+ "object" === typeof parentPropertyName &&
1115
+ null !== parentPropertyName &&
1116
+ (parentPropertyName.$$typeof === REACT_ELEMENT_TYPE ||
1117
+ parentPropertyName.$$typeof === REACT_LAZY_TYPE)),
1118
+ (value =
1081
1119
  thrownValue === SuspenseException
1082
1120
  ? getSuspendedThenable()
1083
1121
  : thrownValue),
1084
- (value = task.model),
1085
- (value =
1086
- "object" === typeof value &&
1122
+ "object" === typeof value &&
1087
1123
  null !== value &&
1088
- (value.$$typeof === REACT_ELEMENT_TYPE ||
1089
- value.$$typeof === REACT_LAZY_TYPE)),
1090
- "object" === typeof parentPropertyName &&
1091
- null !== parentPropertyName &&
1092
- "function" === typeof parentPropertyName.then)
1093
- ) {
1094
- JSCompiler_inline_result = createTask(
1095
- request,
1096
- task.model,
1097
- task.keyPath,
1098
- task.implicitSlot,
1099
- request.abortableTasks
1100
- );
1101
- var ping = JSCompiler_inline_result.ping;
1102
- parentPropertyName.then(ping, ping);
1103
- JSCompiler_inline_result.thenableState =
1104
- getThenableStateAfterSuspending();
1105
- task.keyPath = prevKeyPath;
1106
- task.implicitSlot = prevImplicitSlot;
1107
- JSCompiler_inline_result = value
1108
- ? "$L" + JSCompiler_inline_result.id.toString(16)
1109
- : serializeByValueID(JSCompiler_inline_result.id);
1110
- } else if (
1111
- ((task.keyPath = prevKeyPath),
1112
- (task.implicitSlot = prevImplicitSlot),
1113
- value)
1124
+ "function" === typeof value.then)
1114
1125
  )
1115
- request.pendingChunks++,
1116
- (prevKeyPath = request.nextChunkId++),
1117
- (prevImplicitSlot = logRecoverableError(
1126
+ if (1 === request.status)
1127
+ (task.status = 3),
1128
+ (prevKeyPath = request.fatalError),
1129
+ (JSCompiler_inline_result = parentPropertyName
1130
+ ? "$L" + prevKeyPath.toString(16)
1131
+ : serializeByValueID(prevKeyPath));
1132
+ else {
1133
+ JSCompiler_inline_result = createTask(
1118
1134
  request,
1119
- parentPropertyName
1120
- )),
1121
- emitErrorChunk(request, prevKeyPath, prevImplicitSlot),
1122
- (JSCompiler_inline_result = "$L" + prevKeyPath.toString(16));
1123
- else throw parentPropertyName;
1135
+ task.model,
1136
+ task.keyPath,
1137
+ task.implicitSlot,
1138
+ request.abortableTasks
1139
+ );
1140
+ var ping = JSCompiler_inline_result.ping;
1141
+ value.then(ping, ping);
1142
+ JSCompiler_inline_result.thenableState =
1143
+ getThenableStateAfterSuspending();
1144
+ task.keyPath = prevKeyPath;
1145
+ task.implicitSlot = prevImplicitSlot;
1146
+ JSCompiler_inline_result = parentPropertyName
1147
+ ? "$L" + JSCompiler_inline_result.id.toString(16)
1148
+ : serializeByValueID(JSCompiler_inline_result.id);
1149
+ }
1150
+ else
1151
+ thrownValue === AbortSigil
1152
+ ? ((task.status = 3),
1153
+ (prevKeyPath = request.fatalError),
1154
+ (JSCompiler_inline_result = parentPropertyName
1155
+ ? "$L" + prevKeyPath.toString(16)
1156
+ : serializeByValueID(prevKeyPath)))
1157
+ : ((task.keyPath = prevKeyPath),
1158
+ (task.implicitSlot = prevImplicitSlot),
1159
+ request.pendingChunks++,
1160
+ (prevKeyPath = request.nextChunkId++),
1161
+ (prevImplicitSlot = logRecoverableError(request, value)),
1162
+ emitErrorChunk(request, prevKeyPath, prevImplicitSlot),
1163
+ (JSCompiler_inline_result = parentPropertyName
1164
+ ? "$L" + prevKeyPath.toString(16)
1165
+ : serializeByValueID(prevKeyPath)));
1124
1166
  }
1125
1167
  return JSCompiler_inline_result;
1126
1168
  },
@@ -1250,7 +1292,8 @@ function renderModelDestructive(
1250
1292
  if ("object" === typeof value) {
1251
1293
  switch (value.$$typeof) {
1252
1294
  case REACT_ELEMENT_TYPE:
1253
- var writtenObjects = request.writtenObjects;
1295
+ var elementReference = null,
1296
+ writtenObjects = request.writtenObjects;
1254
1297
  if (null === task.keyPath && !task.implicitSlot) {
1255
1298
  var existingReference = writtenObjects.get(value);
1256
1299
  if (void 0 !== existingReference)
@@ -1260,11 +1303,12 @@ function renderModelDestructive(
1260
1303
  -1 === parentPropertyName.indexOf(":") &&
1261
1304
  ((parent = writtenObjects.get(parent)),
1262
1305
  void 0 !== parent &&
1263
- writtenObjects.set(value, parent + ":" + parentPropertyName));
1306
+ ((elementReference = parent + ":" + parentPropertyName),
1307
+ writtenObjects.set(value, elementReference)));
1264
1308
  }
1265
1309
  parentPropertyName = value.props;
1266
1310
  parent = parentPropertyName.ref;
1267
- return renderElement(
1311
+ request = renderElement(
1268
1312
  request,
1269
1313
  task,
1270
1314
  value.type,
@@ -1272,13 +1316,18 @@ function renderModelDestructive(
1272
1316
  void 0 !== parent ? parent : null,
1273
1317
  parentPropertyName
1274
1318
  );
1319
+ "object" === typeof request &&
1320
+ null !== request &&
1321
+ null !== elementReference &&
1322
+ (writtenObjects.has(request) ||
1323
+ writtenObjects.set(request, elementReference));
1324
+ return request;
1275
1325
  case REACT_LAZY_TYPE:
1276
- return (
1277
- (task.thenableState = null),
1278
- (parentPropertyName = value._init),
1279
- (value = parentPropertyName(value._payload)),
1280
- renderModelDestructive(request, task, emptyRoot, "", value)
1281
- );
1326
+ task.thenableState = null;
1327
+ parentPropertyName = value._init;
1328
+ value = parentPropertyName(value._payload);
1329
+ if (1 === request.status) throw AbortSigil;
1330
+ return renderModelDestructive(request, task, emptyRoot, "", value);
1282
1331
  case REACT_LEGACY_ELEMENT_TYPE:
1283
1332
  throw Error(
1284
1333
  '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.'
@@ -1293,44 +1342,44 @@ function renderModelDestructive(
1293
1342
  );
1294
1343
  if (
1295
1344
  void 0 !== request.temporaryReferences &&
1296
- ((writtenObjects = request.temporaryReferences.get(value)),
1297
- void 0 !== writtenObjects)
1345
+ ((elementReference = request.temporaryReferences.get(value)),
1346
+ void 0 !== elementReference)
1298
1347
  )
1299
- return "$T" + writtenObjects;
1300
- writtenObjects = request.writtenObjects;
1301
- existingReference = writtenObjects.get(value);
1348
+ return "$T" + elementReference;
1349
+ elementReference = request.writtenObjects;
1350
+ writtenObjects = elementReference.get(value);
1302
1351
  if ("function" === typeof value.then) {
1303
- if (void 0 !== existingReference) {
1352
+ if (void 0 !== writtenObjects) {
1304
1353
  if (null !== task.keyPath || task.implicitSlot)
1305
1354
  return "$@" + serializeThenable(request, task, value).toString(16);
1306
1355
  if (modelRoot === value) modelRoot = null;
1307
- else return existingReference;
1356
+ else return writtenObjects;
1308
1357
  }
1309
1358
  request = "$@" + serializeThenable(request, task, value).toString(16);
1310
- writtenObjects.set(value, request);
1359
+ elementReference.set(value, request);
1311
1360
  return request;
1312
1361
  }
1313
- if (void 0 !== existingReference)
1362
+ if (void 0 !== writtenObjects)
1314
1363
  if (modelRoot === value) modelRoot = null;
1315
- else return existingReference;
1364
+ else return writtenObjects;
1316
1365
  else if (
1317
1366
  -1 === parentPropertyName.indexOf(":") &&
1318
- ((existingReference = writtenObjects.get(parent)),
1319
- void 0 !== existingReference)
1367
+ ((writtenObjects = elementReference.get(parent)),
1368
+ void 0 !== writtenObjects)
1320
1369
  ) {
1321
- var propertyName = parentPropertyName;
1370
+ existingReference = parentPropertyName;
1322
1371
  if (isArrayImpl(parent) && parent[0] === REACT_ELEMENT_TYPE)
1323
1372
  switch (parentPropertyName) {
1324
1373
  case "1":
1325
- propertyName = "type";
1374
+ existingReference = "type";
1326
1375
  break;
1327
1376
  case "2":
1328
- propertyName = "key";
1377
+ existingReference = "key";
1329
1378
  break;
1330
1379
  case "3":
1331
- propertyName = "props";
1380
+ existingReference = "props";
1332
1381
  }
1333
- writtenObjects.set(value, existingReference + ":" + propertyName);
1382
+ elementReference.set(value, writtenObjects + ":" + existingReference);
1334
1383
  }
1335
1384
  if (isArrayImpl(value)) return renderFragment(request, task, value);
1336
1385
  if (value instanceof Map)
@@ -1492,10 +1541,11 @@ function renderModelDestructive(
1492
1541
  }
1493
1542
  if ("symbol" === typeof value) {
1494
1543
  task = request.writtenSymbols;
1495
- writtenObjects = task.get(value);
1496
- if (void 0 !== writtenObjects) return serializeByValueID(writtenObjects);
1497
- writtenObjects = value.description;
1498
- if (Symbol.for(writtenObjects) !== value)
1544
+ elementReference = task.get(value);
1545
+ if (void 0 !== elementReference)
1546
+ return serializeByValueID(elementReference);
1547
+ elementReference = value.description;
1548
+ if (Symbol.for(elementReference) !== value)
1499
1549
  throw Error(
1500
1550
  "Only global symbols received from Symbol.for(...) can be passed to Client Components. The symbol Symbol.for(" +
1501
1551
  (value.description + ") cannot be found among global symbols.") +
@@ -1506,7 +1556,7 @@ function renderModelDestructive(
1506
1556
  parent = encodeReferenceChunk(
1507
1557
  request,
1508
1558
  parentPropertyName,
1509
- "$S" + writtenObjects
1559
+ "$S" + elementReference
1510
1560
  );
1511
1561
  request.completedImportChunks.push(parent);
1512
1562
  task.set(value, parentPropertyName);
@@ -1539,8 +1589,8 @@ function logRecoverableError(request, error) {
1539
1589
  }
1540
1590
  function fatalError(request, error) {
1541
1591
  null !== request.destination
1542
- ? ((request.status = 2), closeWithError(request.destination, error))
1543
- : ((request.status = 1), (request.fatalError = error));
1592
+ ? ((request.status = 3), closeWithError(request.destination, error))
1593
+ : ((request.status = 2), (request.fatalError = error));
1544
1594
  }
1545
1595
  function emitErrorChunk(request, id, digest) {
1546
1596
  digest = { digest: digest };
@@ -1609,7 +1659,8 @@ function emitChunk(request, task, value) {
1609
1659
  }
1610
1660
  var emptyRoot = {};
1611
1661
  function retryTask(request, task) {
1612
- if (0 === task.status)
1662
+ if (0 === task.status) {
1663
+ task.status = 5;
1613
1664
  try {
1614
1665
  modelRoot = task.model;
1615
1666
  var resolvedModel = renderModelDestructive(
@@ -1636,10 +1687,23 @@ function retryTask(request, task) {
1636
1687
  thrownValue === SuspenseException
1637
1688
  ? getSuspendedThenable()
1638
1689
  : thrownValue;
1639
- if ("object" === typeof x && null !== x && "function" === typeof x.then) {
1640
- var ping = task.ping;
1641
- x.then(ping, ping);
1642
- task.thenableState = getThenableStateAfterSuspending();
1690
+ if ("object" === typeof x && null !== x && "function" === typeof x.then)
1691
+ if (1 === request.status) {
1692
+ request.abortableTasks.delete(task);
1693
+ task.status = 3;
1694
+ var model = stringify(serializeByValueID(request.fatalError));
1695
+ emitModelChunk(request, task.id, model);
1696
+ } else {
1697
+ task.status = 0;
1698
+ task.thenableState = getThenableStateAfterSuspending();
1699
+ var ping = task.ping;
1700
+ x.then(ping, ping);
1701
+ }
1702
+ else if (x === AbortSigil) {
1703
+ request.abortableTasks.delete(task);
1704
+ task.status = 3;
1705
+ var model$19 = stringify(serializeByValueID(request.fatalError));
1706
+ emitModelChunk(request, task.id, model$19);
1643
1707
  } else {
1644
1708
  request.abortableTasks.delete(task);
1645
1709
  task.status = 4;
@@ -1648,6 +1712,7 @@ function retryTask(request, task) {
1648
1712
  }
1649
1713
  } finally {
1650
1714
  }
1715
+ }
1651
1716
  }
1652
1717
  function performWork(request) {
1653
1718
  var prevDispatcher = ReactSharedInternalsServer.H;
@@ -1705,54 +1770,72 @@ function flushCompletedChunks(request, destination) {
1705
1770
  (writtenBytes = 0));
1706
1771
  }
1707
1772
  0 === request.pendingChunks &&
1708
- (destination.close(), (request.destination = null));
1773
+ ((request.status = 3), destination.close(), (request.destination = null));
1774
+ }
1775
+ function startWork(request) {
1776
+ request.flushScheduled = null !== request.destination;
1777
+ scheduleWork(function () {
1778
+ return performWork(request);
1779
+ });
1709
1780
  }
1710
1781
  function enqueueFlush(request) {
1711
- if (
1712
- !1 === request.flushScheduled &&
1782
+ !1 === request.flushScheduled &&
1713
1783
  0 === request.pingedTasks.length &&
1714
- null !== request.destination
1715
- ) {
1716
- var destination = request.destination;
1717
- request.flushScheduled = !0;
1718
- flushCompletedChunks(request, destination);
1719
- }
1784
+ null !== request.destination &&
1785
+ ((request.flushScheduled = !0),
1786
+ scheduleWork(function () {
1787
+ request.flushScheduled = !1;
1788
+ var destination = request.destination;
1789
+ destination && flushCompletedChunks(request, destination);
1790
+ }));
1720
1791
  }
1721
1792
  function abort(request, reason) {
1722
1793
  try {
1794
+ request.status = 1;
1723
1795
  var abortableTasks = request.abortableTasks;
1724
1796
  if (0 < abortableTasks.size) {
1725
1797
  request.pendingChunks++;
1726
- var errorId = request.nextChunkId++,
1727
- error =
1798
+ var errorId = request.nextChunkId++;
1799
+ request.fatalError = errorId;
1800
+ var error =
1728
1801
  void 0 === reason
1729
1802
  ? Error("The render was aborted by the server without a reason.")
1803
+ : "object" === typeof reason &&
1804
+ null !== reason &&
1805
+ "function" === typeof reason.then
1806
+ ? Error("The render was aborted by the server with a promise.")
1730
1807
  : reason,
1731
1808
  digest = logRecoverableError(request, error);
1732
1809
  emitErrorChunk(request, errorId, digest, error);
1733
1810
  abortableTasks.forEach(function (task) {
1734
- task.status = 3;
1735
- var ref = serializeByValueID(errorId);
1736
- task = encodeReferenceChunk(request, task.id, ref);
1737
- request.completedErrorChunks.push(task);
1811
+ if (5 !== task.status) {
1812
+ task.status = 3;
1813
+ var ref = serializeByValueID(errorId);
1814
+ task = encodeReferenceChunk(request, task.id, ref);
1815
+ request.completedErrorChunks.push(task);
1816
+ }
1738
1817
  });
1739
1818
  abortableTasks.clear();
1740
1819
  }
1741
1820
  var abortListeners = request.abortListeners;
1742
1821
  if (0 < abortListeners.size) {
1743
- var error$22 =
1822
+ var error$26 =
1744
1823
  void 0 === reason
1745
1824
  ? Error("The render was aborted by the server without a reason.")
1825
+ : "object" === typeof reason &&
1826
+ null !== reason &&
1827
+ "function" === typeof reason.then
1828
+ ? Error("The render was aborted by the server with a promise.")
1746
1829
  : reason;
1747
1830
  abortListeners.forEach(function (callback) {
1748
- return callback(error$22);
1831
+ return callback(error$26);
1749
1832
  });
1750
1833
  abortListeners.clear();
1751
1834
  }
1752
1835
  null !== request.destination &&
1753
1836
  flushCompletedChunks(request, request.destination);
1754
- } catch (error$23) {
1755
- logRecoverableError(request, error$23), fatalError(request, error$23);
1837
+ } catch (error$27) {
1838
+ logRecoverableError(request, error$27), fatalError(request, error$27);
1756
1839
  }
1757
1840
  }
1758
1841
  function resolveServerReference(bundlerConfig, id) {
@@ -2204,8 +2287,8 @@ function parseReadableStream(response, reference, type) {
2204
2287
  (previousBlockedChunk = chunk));
2205
2288
  } else {
2206
2289
  chunk = previousBlockedChunk;
2207
- var chunk$26 = createPendingChunk(response);
2208
- chunk$26.then(
2290
+ var chunk$30 = createPendingChunk(response);
2291
+ chunk$30.then(
2209
2292
  function (v) {
2210
2293
  return controller.enqueue(v);
2211
2294
  },
@@ -2213,10 +2296,10 @@ function parseReadableStream(response, reference, type) {
2213
2296
  return controller.error(e);
2214
2297
  }
2215
2298
  );
2216
- previousBlockedChunk = chunk$26;
2299
+ previousBlockedChunk = chunk$30;
2217
2300
  chunk.then(function () {
2218
- previousBlockedChunk === chunk$26 && (previousBlockedChunk = null);
2219
- resolveModelChunk(chunk$26, json, -1);
2301
+ previousBlockedChunk === chunk$30 && (previousBlockedChunk = null);
2302
+ resolveModelChunk(chunk$30, json, -1);
2220
2303
  });
2221
2304
  }
2222
2305
  },
@@ -2557,7 +2640,7 @@ exports.registerServerReference = function (reference, id, exportName) {
2557
2640
  });
2558
2641
  };
2559
2642
  exports.renderToReadableStream = function (model, webpackMap, options) {
2560
- var request = createRequest(
2643
+ var request = new RequestInstance(
2561
2644
  model,
2562
2645
  webpackMap,
2563
2646
  options ? options.onError : void 0,
@@ -2581,13 +2664,12 @@ exports.renderToReadableStream = function (model, webpackMap, options) {
2581
2664
  {
2582
2665
  type: "bytes",
2583
2666
  start: function () {
2584
- request.flushScheduled = null !== request.destination;
2585
- performWork(request);
2667
+ startWork(request);
2586
2668
  },
2587
2669
  pull: function (controller) {
2588
- if (1 === request.status)
2589
- (request.status = 2), closeWithError(controller, request.fatalError);
2590
- else if (2 !== request.status && null === request.destination) {
2670
+ if (2 === request.status)
2671
+ (request.status = 3), closeWithError(controller, request.fatalError);
2672
+ else if (3 !== request.status && null === request.destination) {
2591
2673
  request.destination = controller;
2592
2674
  try {
2593
2675
  flushCompletedChunks(request, controller);