react-server-dom-webpack 18.3.0-next-a8875eab7-20230310 → 18.3.0-next-56a3c18e5-20230314

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.
Files changed (21) hide show
  1. package/cjs/react-server-dom-webpack-client.browser.development.js +582 -1
  2. package/cjs/react-server-dom-webpack-client.browser.production.min.js +22 -19
  3. package/cjs/react-server-dom-webpack-client.edge.development.js +4 -1
  4. package/cjs/react-server-dom-webpack-client.edge.production.min.js +16 -16
  5. package/cjs/react-server-dom-webpack-client.node.development.js +4 -1
  6. package/cjs/react-server-dom-webpack-client.node.production.min.js +18 -18
  7. package/cjs/react-server-dom-webpack-client.node.unbundled.development.js +3 -0
  8. package/cjs/react-server-dom-webpack-client.node.unbundled.production.min.js +15 -15
  9. package/cjs/react-server-dom-webpack-server.browser.development.js +1146 -617
  10. package/cjs/react-server-dom-webpack-server.browser.production.min.js +57 -46
  11. package/cjs/react-server-dom-webpack-server.edge.development.js +1146 -617
  12. package/cjs/react-server-dom-webpack-server.edge.production.min.js +55 -44
  13. package/cjs/react-server-dom-webpack-server.node.development.js +1181 -613
  14. package/cjs/react-server-dom-webpack-server.node.production.min.js +58 -46
  15. package/cjs/react-server-dom-webpack-server.node.unbundled.development.js +1145 -617
  16. package/cjs/react-server-dom-webpack-server.node.unbundled.production.min.js +52 -41
  17. package/package.json +3 -3
  18. package/umd/react-server-dom-webpack-client.browser.development.js +582 -1
  19. package/umd/react-server-dom-webpack-client.browser.production.min.js +17 -14
  20. package/umd/react-server-dom-webpack-server.browser.development.js +1146 -617
  21. package/umd/react-server-dom-webpack-server.browser.production.min.js +44 -37
@@ -51,7 +51,7 @@ function resolveClientReference(bundlerConfig, metadata) {
51
51
  }
52
52
 
53
53
  return metadata;
54
- } // The chunk cache contains all the chunks we've preloaded so far.
54
+ }
55
55
  // If they're still pending they're a thenable. This map also exists
56
56
  // in Webpack but unfortunately it's not exposed so we have to
57
57
  // replicate it in user space. null means that it has already loaded.
@@ -150,13 +150,35 @@ function requireModule(metadata) {
150
150
  return moduleExports[metadata.name];
151
151
  }
152
152
 
153
+ var knownServerReferences = new WeakMap();
154
+
153
155
  // ATTENTION
154
156
  // When adding new symbols to this file,
155
157
  // Please consider also adding to 'react-devtools-shared/src/backend/ReactSymbols'
156
158
  // The Symbol used to tag the ReactElement-like types.
157
159
  var REACT_ELEMENT_TYPE = Symbol.for('react.element');
160
+ var REACT_PROVIDER_TYPE = Symbol.for('react.provider');
161
+ var REACT_FORWARD_REF_TYPE = Symbol.for('react.forward_ref');
162
+ var REACT_SUSPENSE_TYPE = Symbol.for('react.suspense');
163
+ var REACT_SUSPENSE_LIST_TYPE = Symbol.for('react.suspense_list');
164
+ var REACT_MEMO_TYPE = Symbol.for('react.memo');
158
165
  var REACT_LAZY_TYPE = Symbol.for('react.lazy');
159
166
  var REACT_SERVER_CONTEXT_DEFAULT_VALUE_NOT_LOADED = Symbol.for('react.default_value');
167
+ var MAYBE_ITERATOR_SYMBOL = Symbol.iterator;
168
+ var FAUX_ITERATOR_SYMBOL = '@@iterator';
169
+ function getIteratorFn(maybeIterable) {
170
+ if (maybeIterable === null || typeof maybeIterable !== 'object') {
171
+ return null;
172
+ }
173
+
174
+ var maybeIterator = MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL];
175
+
176
+ if (typeof maybeIterator === 'function') {
177
+ return maybeIterator;
178
+ }
179
+
180
+ return null;
181
+ }
160
182
 
161
183
  var ReactSharedInternals = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
162
184
 
@@ -563,6 +585,7 @@ function createServerReferenceProxy(response, metaData) {
563
585
  });
564
586
  };
565
587
 
588
+ knownServerReferences.set(proxy, metaData);
566
589
  return proxy;
567
590
  }
568
591
 
@@ -884,6 +907,555 @@ function createResponse(bundlerConfig, callServer) {
884
907
  return response;
885
908
  }
886
909
 
910
+ function error(format) {
911
+ {
912
+ {
913
+ for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
914
+ args[_key2 - 1] = arguments[_key2];
915
+ }
916
+
917
+ printWarning('error', format, args);
918
+ }
919
+ }
920
+ }
921
+
922
+ function printWarning(level, format, args) {
923
+ // When changing this logic, you might want to also
924
+ // update consoleWithStackDev.www.js as well.
925
+ {
926
+ var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;
927
+ var stack = ReactDebugCurrentFrame.getStackAddendum();
928
+
929
+ if (stack !== '') {
930
+ format += '%s';
931
+ args = args.concat([stack]);
932
+ } // eslint-disable-next-line react-internal/safe-string-coercion
933
+
934
+
935
+ var argsWithFormat = args.map(function (item) {
936
+ return String(item);
937
+ }); // Careful: RN currently depends on this prefix
938
+
939
+ argsWithFormat.unshift('Warning: ' + format); // We intentionally don't use spread (or .apply) directly because it
940
+ // breaks IE9: https://github.com/facebook/react/issues/13610
941
+ // eslint-disable-next-line react-internal/no-production-logging
942
+
943
+ Function.prototype.apply.call(console[level], console, argsWithFormat);
944
+ }
945
+ }
946
+
947
+ var isArrayImpl = Array.isArray; // eslint-disable-next-line no-redeclare
948
+
949
+ function isArray(a) {
950
+ return isArrayImpl(a);
951
+ }
952
+
953
+ // in case they error.
954
+
955
+ var jsxPropsParents = new WeakMap();
956
+ var jsxChildrenParents = new WeakMap();
957
+
958
+ function isObjectPrototype(object) {
959
+ if (!object) {
960
+ return false;
961
+ }
962
+
963
+ var ObjectPrototype = Object.prototype;
964
+
965
+ if (object === ObjectPrototype) {
966
+ return true;
967
+ } // It might be an object from a different Realm which is
968
+ // still just a plain simple object.
969
+
970
+
971
+ if (Object.getPrototypeOf(object)) {
972
+ return false;
973
+ }
974
+
975
+ var names = Object.getOwnPropertyNames(object);
976
+
977
+ for (var i = 0; i < names.length; i++) {
978
+ if (!(names[i] in ObjectPrototype)) {
979
+ return false;
980
+ }
981
+ }
982
+
983
+ return true;
984
+ }
985
+
986
+ function isSimpleObject(object) {
987
+ if (!isObjectPrototype(Object.getPrototypeOf(object))) {
988
+ return false;
989
+ }
990
+
991
+ var names = Object.getOwnPropertyNames(object);
992
+
993
+ for (var i = 0; i < names.length; i++) {
994
+ var descriptor = Object.getOwnPropertyDescriptor(object, names[i]);
995
+
996
+ if (!descriptor) {
997
+ return false;
998
+ }
999
+
1000
+ if (!descriptor.enumerable) {
1001
+ if ((names[i] === 'key' || names[i] === 'ref') && typeof descriptor.get === 'function') {
1002
+ // React adds key and ref getters to props objects to issue warnings.
1003
+ // Those getters will not be transferred to the client, but that's ok,
1004
+ // so we'll special case them.
1005
+ continue;
1006
+ }
1007
+
1008
+ return false;
1009
+ }
1010
+ }
1011
+
1012
+ return true;
1013
+ }
1014
+ function objectName(object) {
1015
+ // $FlowFixMe[method-unbinding]
1016
+ var name = Object.prototype.toString.call(object);
1017
+ return name.replace(/^\[object (.*)\]$/, function (m, p0) {
1018
+ return p0;
1019
+ });
1020
+ }
1021
+
1022
+ function describeKeyForErrorMessage(key) {
1023
+ var encodedKey = JSON.stringify(key);
1024
+ return '"' + key + '"' === encodedKey ? key : encodedKey;
1025
+ }
1026
+
1027
+ function describeValueForErrorMessage(value) {
1028
+ switch (typeof value) {
1029
+ case 'string':
1030
+ {
1031
+ return JSON.stringify(value.length <= 10 ? value : value.substr(0, 10) + '...');
1032
+ }
1033
+
1034
+ case 'object':
1035
+ {
1036
+ if (isArray(value)) {
1037
+ return '[...]';
1038
+ }
1039
+
1040
+ var name = objectName(value);
1041
+
1042
+ if (name === 'Object') {
1043
+ return '{...}';
1044
+ }
1045
+
1046
+ return name;
1047
+ }
1048
+
1049
+ case 'function':
1050
+ return 'function';
1051
+
1052
+ default:
1053
+ // eslint-disable-next-line react-internal/safe-string-coercion
1054
+ return String(value);
1055
+ }
1056
+ }
1057
+
1058
+ function describeElementType(type) {
1059
+ if (typeof type === 'string') {
1060
+ return type;
1061
+ }
1062
+
1063
+ switch (type) {
1064
+ case REACT_SUSPENSE_TYPE:
1065
+ return 'Suspense';
1066
+
1067
+ case REACT_SUSPENSE_LIST_TYPE:
1068
+ return 'SuspenseList';
1069
+ }
1070
+
1071
+ if (typeof type === 'object') {
1072
+ switch (type.$$typeof) {
1073
+ case REACT_FORWARD_REF_TYPE:
1074
+ return describeElementType(type.render);
1075
+
1076
+ case REACT_MEMO_TYPE:
1077
+ return describeElementType(type.type);
1078
+
1079
+ case REACT_LAZY_TYPE:
1080
+ {
1081
+ var lazyComponent = type;
1082
+ var payload = lazyComponent._payload;
1083
+ var init = lazyComponent._init;
1084
+
1085
+ try {
1086
+ // Lazy may contain any component type so we recursively resolve it.
1087
+ return describeElementType(init(payload));
1088
+ } catch (x) {}
1089
+ }
1090
+ }
1091
+ }
1092
+
1093
+ return '';
1094
+ }
1095
+
1096
+ function describeObjectForErrorMessage(objectOrArray, expandedName) {
1097
+ var objKind = objectName(objectOrArray);
1098
+
1099
+ if (objKind !== 'Object' && objKind !== 'Array') {
1100
+ return objKind;
1101
+ }
1102
+
1103
+ var str = '';
1104
+ var start = -1;
1105
+ var length = 0;
1106
+
1107
+ if (isArray(objectOrArray)) {
1108
+ if (jsxChildrenParents.has(objectOrArray)) {
1109
+ // Print JSX Children
1110
+ var type = jsxChildrenParents.get(objectOrArray);
1111
+ str = '<' + describeElementType(type) + '>';
1112
+ var array = objectOrArray;
1113
+
1114
+ for (var i = 0; i < array.length; i++) {
1115
+ var value = array[i];
1116
+ var substr = void 0;
1117
+
1118
+ if (typeof value === 'string') {
1119
+ substr = value;
1120
+ } else if (typeof value === 'object' && value !== null) {
1121
+ // $FlowFixMe[incompatible-call] found when upgrading Flow
1122
+ substr = '{' + describeObjectForErrorMessage(value) + '}';
1123
+ } else {
1124
+ substr = '{' + describeValueForErrorMessage(value) + '}';
1125
+ }
1126
+
1127
+ if ('' + i === expandedName) {
1128
+ start = str.length;
1129
+ length = substr.length;
1130
+ str += substr;
1131
+ } else if (substr.length < 15 && str.length + substr.length < 40) {
1132
+ str += substr;
1133
+ } else {
1134
+ str += '{...}';
1135
+ }
1136
+ }
1137
+
1138
+ str += '</' + describeElementType(type) + '>';
1139
+ } else {
1140
+ // Print Array
1141
+ str = '[';
1142
+ var _array = objectOrArray;
1143
+
1144
+ for (var _i = 0; _i < _array.length; _i++) {
1145
+ if (_i > 0) {
1146
+ str += ', ';
1147
+ }
1148
+
1149
+ var _value = _array[_i];
1150
+
1151
+ var _substr = void 0;
1152
+
1153
+ if (typeof _value === 'object' && _value !== null) {
1154
+ // $FlowFixMe[incompatible-call] found when upgrading Flow
1155
+ _substr = describeObjectForErrorMessage(_value);
1156
+ } else {
1157
+ _substr = describeValueForErrorMessage(_value);
1158
+ }
1159
+
1160
+ if ('' + _i === expandedName) {
1161
+ start = str.length;
1162
+ length = _substr.length;
1163
+ str += _substr;
1164
+ } else if (_substr.length < 10 && str.length + _substr.length < 40) {
1165
+ str += _substr;
1166
+ } else {
1167
+ str += '...';
1168
+ }
1169
+ }
1170
+
1171
+ str += ']';
1172
+ }
1173
+ } else {
1174
+ if (objectOrArray.$$typeof === REACT_ELEMENT_TYPE) {
1175
+ str = '<' + describeElementType(objectOrArray.type) + '/>';
1176
+ } else if (jsxPropsParents.has(objectOrArray)) {
1177
+ // Print JSX
1178
+ var _type = jsxPropsParents.get(objectOrArray);
1179
+
1180
+ str = '<' + (describeElementType(_type) || '...');
1181
+ var object = objectOrArray;
1182
+ var names = Object.keys(object);
1183
+
1184
+ for (var _i2 = 0; _i2 < names.length; _i2++) {
1185
+ str += ' ';
1186
+ var name = names[_i2];
1187
+ str += describeKeyForErrorMessage(name) + '=';
1188
+ var _value2 = object[name];
1189
+
1190
+ var _substr2 = void 0;
1191
+
1192
+ if (name === expandedName && typeof _value2 === 'object' && _value2 !== null) {
1193
+ // $FlowFixMe[incompatible-call] found when upgrading Flow
1194
+ _substr2 = describeObjectForErrorMessage(_value2);
1195
+ } else {
1196
+ _substr2 = describeValueForErrorMessage(_value2);
1197
+ }
1198
+
1199
+ if (typeof _value2 !== 'string') {
1200
+ _substr2 = '{' + _substr2 + '}';
1201
+ }
1202
+
1203
+ if (name === expandedName) {
1204
+ start = str.length;
1205
+ length = _substr2.length;
1206
+ str += _substr2;
1207
+ } else if (_substr2.length < 10 && str.length + _substr2.length < 40) {
1208
+ str += _substr2;
1209
+ } else {
1210
+ str += '...';
1211
+ }
1212
+ }
1213
+
1214
+ str += '>';
1215
+ } else {
1216
+ // Print Object
1217
+ str = '{';
1218
+ var _object = objectOrArray;
1219
+
1220
+ var _names = Object.keys(_object);
1221
+
1222
+ for (var _i3 = 0; _i3 < _names.length; _i3++) {
1223
+ if (_i3 > 0) {
1224
+ str += ', ';
1225
+ }
1226
+
1227
+ var _name = _names[_i3];
1228
+ str += describeKeyForErrorMessage(_name) + ': ';
1229
+ var _value3 = _object[_name];
1230
+
1231
+ var _substr3 = void 0;
1232
+
1233
+ if (typeof _value3 === 'object' && _value3 !== null) {
1234
+ // $FlowFixMe[incompatible-call] found when upgrading Flow
1235
+ _substr3 = describeObjectForErrorMessage(_value3);
1236
+ } else {
1237
+ _substr3 = describeValueForErrorMessage(_value3);
1238
+ }
1239
+
1240
+ if (_name === expandedName) {
1241
+ start = str.length;
1242
+ length = _substr3.length;
1243
+ str += _substr3;
1244
+ } else if (_substr3.length < 10 && str.length + _substr3.length < 40) {
1245
+ str += _substr3;
1246
+ } else {
1247
+ str += '...';
1248
+ }
1249
+ }
1250
+
1251
+ str += '}';
1252
+ }
1253
+ }
1254
+
1255
+ if (expandedName === undefined) {
1256
+ return str;
1257
+ }
1258
+
1259
+ if (start > -1 && length > 0) {
1260
+ var highlight = ' '.repeat(start) + '^'.repeat(length);
1261
+ return '\n ' + str + '\n ' + highlight;
1262
+ }
1263
+
1264
+ return '\n ' + str;
1265
+ }
1266
+
1267
+ // Thenable<ReactServerValue>
1268
+ // function serializeByValueID(id: number): string {
1269
+ // return '$' + id.toString(16);
1270
+ // }
1271
+
1272
+ function serializePromiseID(id) {
1273
+ return '$@' + id.toString(16);
1274
+ }
1275
+
1276
+ function serializeServerReferenceID(id) {
1277
+ return '$F' + id.toString(16);
1278
+ }
1279
+
1280
+ function serializeSymbolReference(name) {
1281
+ return '$S' + name;
1282
+ }
1283
+
1284
+ function serializeUndefined() {
1285
+ return '$undefined';
1286
+ }
1287
+
1288
+ function escapeStringValue(value) {
1289
+ if (value[0] === '$') {
1290
+ // We need to escape $ prefixed strings since we use those to encode
1291
+ // references to IDs and as special symbol values.
1292
+ return '$' + value;
1293
+ } else {
1294
+ return value;
1295
+ }
1296
+ }
1297
+
1298
+ function processReply(root, resolve, reject) {
1299
+ var nextPartId = 1;
1300
+ var pendingParts = 0;
1301
+ var formData = null;
1302
+
1303
+ function resolveToJSON(key, value) {
1304
+ var parent = this;
1305
+
1306
+ {
1307
+ // $FlowFixMe
1308
+ var originalValue = this[key];
1309
+
1310
+ if (typeof originalValue === 'object' && originalValue !== value) {
1311
+ if (objectName(originalValue) !== 'Object') {
1312
+ error('Only plain objects can be passed to Server Functions from the Client. ' + '%s objects are not supported.%s', objectName(originalValue), describeObjectForErrorMessage(parent, key));
1313
+ } else {
1314
+ error('Only plain objects can be passed to Server Functions from the Client. ' + 'Objects with toJSON methods are not supported. Convert it manually ' + 'to a simple value before passing it to props.%s', describeObjectForErrorMessage(parent, key));
1315
+ }
1316
+ }
1317
+ }
1318
+
1319
+ if (value === null) {
1320
+ return null;
1321
+ }
1322
+
1323
+ if (typeof value === 'object') {
1324
+ // $FlowFixMe[method-unbinding]
1325
+ if (typeof value.then === 'function') {
1326
+ // We assume that any object with a .then property is a "Thenable" type,
1327
+ // or a Promise type. Either of which can be represented by a Promise.
1328
+ if (formData === null) {
1329
+ // Upgrade to use FormData to allow us to stream this value.
1330
+ formData = new FormData();
1331
+ }
1332
+
1333
+ pendingParts++;
1334
+ var promiseId = nextPartId++;
1335
+ var thenable = value;
1336
+ thenable.then(function (partValue) {
1337
+ var partJSON = JSON.stringify(partValue, resolveToJSON); // $FlowFixMe[incompatible-type] We know it's not null because we assigned it above.
1338
+
1339
+ var data = formData; // eslint-disable-next-line react-internal/safe-string-coercion
1340
+
1341
+ data.append('' + promiseId, partJSON);
1342
+ pendingParts--;
1343
+
1344
+ if (pendingParts === 0) {
1345
+ resolve(data);
1346
+ }
1347
+ }, function (reason) {
1348
+ // In the future we could consider serializing this as an error
1349
+ // that throws on the server instead.
1350
+ reject(reason);
1351
+ });
1352
+ return serializePromiseID(promiseId);
1353
+ }
1354
+
1355
+ if (!isArray(value)) {
1356
+ var iteratorFn = getIteratorFn(value);
1357
+
1358
+ if (iteratorFn) {
1359
+ return Array.from(value);
1360
+ }
1361
+ }
1362
+
1363
+ {
1364
+ if (value !== null && !isArray(value)) {
1365
+ // Verify that this is a simple plain object.
1366
+ if (value.$$typeof === REACT_ELEMENT_TYPE) {
1367
+ error('React Element cannot be passed to Server Functions from the Client.%s', describeObjectForErrorMessage(parent, key));
1368
+ } else if (value.$$typeof === REACT_LAZY_TYPE) {
1369
+ error('React Lazy cannot be passed to Server Functions from the Client.%s', describeObjectForErrorMessage(parent, key));
1370
+ } else if (value.$$typeof === REACT_PROVIDER_TYPE) {
1371
+ error('React Context Providers cannot be passed to Server Functions from the Client.%s', describeObjectForErrorMessage(parent, key));
1372
+ } else if (objectName(value) !== 'Object') {
1373
+ error('Only plain objects can be passed to Client Components from Server Components. ' + '%s objects are not supported.%s', objectName(value), describeObjectForErrorMessage(parent, key));
1374
+ } else if (!isSimpleObject(value)) {
1375
+ error('Only plain objects can be passed to Client Components from Server Components. ' + 'Classes or other objects with methods are not supported.%s', describeObjectForErrorMessage(parent, key));
1376
+ } else if (Object.getOwnPropertySymbols) {
1377
+ var symbols = Object.getOwnPropertySymbols(value);
1378
+
1379
+ if (symbols.length > 0) {
1380
+ error('Only plain objects can be passed to Client Components from Server Components. ' + 'Objects with symbol properties like %s are not supported.%s', symbols[0].description, describeObjectForErrorMessage(parent, key));
1381
+ }
1382
+ }
1383
+ }
1384
+ } // $FlowFixMe
1385
+
1386
+
1387
+ return value;
1388
+ }
1389
+
1390
+ if (typeof value === 'string') {
1391
+ return escapeStringValue(value);
1392
+ }
1393
+
1394
+ if (typeof value === 'boolean' || typeof value === 'number') {
1395
+ return value;
1396
+ }
1397
+
1398
+ if (typeof value === 'undefined') {
1399
+ return serializeUndefined();
1400
+ }
1401
+
1402
+ if (typeof value === 'function') {
1403
+ var metaData = knownServerReferences.get(value);
1404
+
1405
+ if (metaData !== undefined) {
1406
+ var metaDataJSON = JSON.stringify(metaData, resolveToJSON);
1407
+
1408
+ if (formData === null) {
1409
+ // Upgrade to use FormData to allow us to stream this value.
1410
+ formData = new FormData();
1411
+ } // The reference to this function came from the same client so we can pass it back.
1412
+
1413
+
1414
+ var refId = nextPartId++; // eslint-disable-next-line react-internal/safe-string-coercion
1415
+
1416
+ formData.set('' + refId, metaDataJSON);
1417
+ return serializeServerReferenceID(refId);
1418
+ }
1419
+
1420
+ throw new Error('Client Functions cannot be passed directly to Server Functions. ' + 'Only Functions passed from the Server can be passed back again.');
1421
+ }
1422
+
1423
+ if (typeof value === 'symbol') {
1424
+ // $FlowFixMe `description` might be undefined
1425
+ var name = value.description;
1426
+
1427
+ if (Symbol.for(name) !== value) {
1428
+ throw new Error('Only global symbols received from Symbol.for(...) can be passed to Server Functions. ' + ("The symbol Symbol.for(" + // $FlowFixMe `description` might be undefined
1429
+ value.description + ") cannot be found among global symbols."));
1430
+ }
1431
+
1432
+ return serializeSymbolReference(name);
1433
+ }
1434
+
1435
+ if (typeof value === 'bigint') {
1436
+ throw new Error("BigInt (" + value + ") is not yet supported as an argument to a Server Function.");
1437
+ }
1438
+
1439
+ throw new Error("Type " + typeof value + " is not supported as an argument to a Server Function.");
1440
+ } // $FlowFixMe[incompatible-type] it's not going to be undefined because we'll encode it.
1441
+
1442
+
1443
+ var json = JSON.stringify(root, resolveToJSON);
1444
+
1445
+ if (formData === null) {
1446
+ // If it's a simple data structure, we just use plain JSON.
1447
+ resolve(json);
1448
+ } else {
1449
+ // Otherwise, we use FormData to let us stream in the result.
1450
+ formData.set('0', json);
1451
+
1452
+ if (pendingParts === 0) {
1453
+ // $FlowFixMe[incompatible-call] this has already been refined.
1454
+ resolve(formData);
1455
+ }
1456
+ }
1457
+ }
1458
+
887
1459
  function createResponseFromOptions(options) {
888
1460
  return createResponse(null, options && options.callServer ? options.callServer : undefined);
889
1461
  }
@@ -955,8 +1527,17 @@ function createFromXHR(request, options) {
955
1527
  return getRoot(response);
956
1528
  }
957
1529
 
1530
+ function encodeReply(value)
1531
+ /* We don't use URLSearchParams yet but maybe */
1532
+ {
1533
+ return new Promise(function (resolve, reject) {
1534
+ processReply(value, resolve, reject);
1535
+ });
1536
+ }
1537
+
958
1538
  exports.createFromFetch = createFromFetch;
959
1539
  exports.createFromReadableStream = createFromReadableStream;
960
1540
  exports.createFromXHR = createFromXHR;
1541
+ exports.encodeReply = encodeReply;
961
1542
  })();
962
1543
  }