react-dom 16.6.0-alpha.8af6728 → 16.6.3

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.
@@ -1,4 +1,4 @@
1
- /** @license React v16.6.0-alpha.8af6728
1
+ /** @license React v16.6.1
2
2
  * react-dom-server.node.development.js
3
3
  *
4
4
  * Copyright (c) Facebook, Inc. and its affiliates.
@@ -22,7 +22,7 @@ var stream = require('stream');
22
22
 
23
23
  // TODO: this is special because it gets imported during build.
24
24
 
25
- var ReactVersion = '16.6.0-alpha.8af6728';
25
+ var ReactVersion = '16.6.3';
26
26
 
27
27
  /**
28
28
  * Use invariant() to assert state which your program assumes to be true.
@@ -95,63 +95,24 @@ var warningWithoutStack = function () {};
95
95
  return;
96
96
  }
97
97
  if (typeof console !== 'undefined') {
98
- var _args$map = args.map(function (item) {
98
+ var argsWithFormat = args.map(function (item) {
99
99
  return '' + item;
100
- }),
101
- a = _args$map[0],
102
- b = _args$map[1],
103
- c = _args$map[2],
104
- d = _args$map[3],
105
- e = _args$map[4],
106
- f = _args$map[5],
107
- g = _args$map[6],
108
- h = _args$map[7];
109
-
110
- var message = 'Warning: ' + format;
111
-
112
- // We intentionally don't use spread (or .apply) because it breaks IE9:
113
- // https://github.com/facebook/react/issues/13610
114
- switch (args.length) {
115
- case 0:
116
- console.error(message);
117
- break;
118
- case 1:
119
- console.error(message, a);
120
- break;
121
- case 2:
122
- console.error(message, a, b);
123
- break;
124
- case 3:
125
- console.error(message, a, b, c);
126
- break;
127
- case 4:
128
- console.error(message, a, b, c, d);
129
- break;
130
- case 5:
131
- console.error(message, a, b, c, d, e);
132
- break;
133
- case 6:
134
- console.error(message, a, b, c, d, e, f);
135
- break;
136
- case 7:
137
- console.error(message, a, b, c, d, e, f, g);
138
- break;
139
- case 8:
140
- console.error(message, a, b, c, d, e, f, g, h);
141
- break;
142
- default:
143
- throw new Error('warningWithoutStack() currently supports at most 8 arguments.');
144
- }
100
+ });
101
+ argsWithFormat.unshift('Warning: ' + format);
102
+
103
+ // We intentionally don't use spread (or .apply) directly because it
104
+ // breaks IE9: https://github.com/facebook/react/issues/13610
105
+ Function.prototype.apply.call(console.error, console, argsWithFormat);
145
106
  }
146
107
  try {
147
108
  // --- Welcome to debugging React ---
148
109
  // This error was thrown as a convenience so that you can use this stack
149
110
  // to find the callsite that caused this warning to fire.
150
111
  var argIndex = 0;
151
- var _message = 'Warning: ' + format.replace(/%s/g, function () {
112
+ var message = 'Warning: ' + format.replace(/%s/g, function () {
152
113
  return args[argIndex++];
153
114
  });
154
- throw new Error(_message);
115
+ throw new Error(message);
155
116
  } catch (x) {}
156
117
  };
157
118
  }
@@ -169,17 +130,23 @@ var REACT_STRICT_MODE_TYPE = hasSymbol ? Symbol.for('react.strict_mode') : 0xeac
169
130
  var REACT_PROFILER_TYPE = hasSymbol ? Symbol.for('react.profiler') : 0xead2;
170
131
  var REACT_PROVIDER_TYPE = hasSymbol ? Symbol.for('react.provider') : 0xeacd;
171
132
  var REACT_CONTEXT_TYPE = hasSymbol ? Symbol.for('react.context') : 0xeace;
133
+
172
134
  var REACT_CONCURRENT_MODE_TYPE = hasSymbol ? Symbol.for('react.concurrent_mode') : 0xeacf;
173
135
  var REACT_FORWARD_REF_TYPE = hasSymbol ? Symbol.for('react.forward_ref') : 0xead0;
174
136
  var REACT_SUSPENSE_TYPE = hasSymbol ? Symbol.for('react.suspense') : 0xead1;
137
+ var REACT_MEMO_TYPE = hasSymbol ? Symbol.for('react.memo') : 0xead3;
138
+ var REACT_LAZY_TYPE = hasSymbol ? Symbol.for('react.lazy') : 0xead4;
175
139
 
176
140
  var Resolved = 1;
177
141
 
178
142
 
143
+ function refineResolvedLazyComponent(lazyComponent) {
144
+ return lazyComponent._status === Resolved ? lazyComponent._result : null;
145
+ }
179
146
 
180
-
181
- function refineResolvedThenable(thenable) {
182
- return thenable._reactStatus === Resolved ? thenable._reactResult : null;
147
+ function getWrappedName(outerType, innerType, wrapperName) {
148
+ var functionName = innerType.displayName || innerType.name || '';
149
+ return outerType.displayName || (functionName !== '' ? wrapperName + '(' + functionName + ')' : wrapperName);
183
150
  }
184
151
 
185
152
  function getComponentName(type) {
@@ -219,16 +186,17 @@ function getComponentName(type) {
219
186
  case REACT_PROVIDER_TYPE:
220
187
  return 'Context.Provider';
221
188
  case REACT_FORWARD_REF_TYPE:
222
- var renderFn = type.render;
223
- var functionName = renderFn.displayName || renderFn.name || '';
224
- return type.displayName || (functionName !== '' ? 'ForwardRef(' + functionName + ')' : 'ForwardRef');
225
- }
226
- if (typeof type.then === 'function') {
227
- var thenable = type;
228
- var resolvedThenable = refineResolvedThenable(thenable);
229
- if (resolvedThenable) {
230
- return getComponentName(resolvedThenable);
231
- }
189
+ return getWrappedName(type, type.render, 'ForwardRef');
190
+ case REACT_MEMO_TYPE:
191
+ return getComponentName(type.type);
192
+ case REACT_LAZY_TYPE:
193
+ {
194
+ var thenable = type;
195
+ var resolvedThenable = refineResolvedLazyComponent(thenable);
196
+ if (resolvedThenable) {
197
+ return getComponentName(resolvedThenable);
198
+ }
199
+ }
232
200
  }
233
201
  }
234
202
  return null;
@@ -345,6 +313,7 @@ var describeComponentFrame = function (name, source, ownerName) {
345
313
  return '\n in ' + (name || 'Unknown') + sourceInfo;
346
314
  };
347
315
 
316
+ var enableHooks = false;
348
317
  // Helps identify side effects in begin-phase lifecycle hooks and setState reducers:
349
318
 
350
319
 
@@ -376,6 +345,118 @@ var enableSuspenseServerRenderer = false;
376
345
  // React Fire: prevent the value and checked attributes from syncing
377
346
  // with their related DOM properties
378
347
 
348
+
349
+ // These APIs will no longer be "unstable" in the upcoming 16.7 release,
350
+ // Control this behavior with a flag to support 16.6 minor releases in the meanwhile.
351
+
352
+ var ReactDebugCurrentFrame$1 = void 0;
353
+ {
354
+ ReactDebugCurrentFrame$1 = ReactSharedInternals.ReactDebugCurrentFrame;
355
+ }
356
+
357
+ var didWarnAboutInvalidateContextType = {};
358
+
359
+ var emptyObject = {};
360
+ {
361
+ Object.freeze(emptyObject);
362
+ }
363
+
364
+ function maskContext(type, context) {
365
+ var contextTypes = type.contextTypes;
366
+ if (!contextTypes) {
367
+ return emptyObject;
368
+ }
369
+ var maskedContext = {};
370
+ for (var contextName in contextTypes) {
371
+ maskedContext[contextName] = context[contextName];
372
+ }
373
+ return maskedContext;
374
+ }
375
+
376
+ function checkContextTypes(typeSpecs, values, location) {
377
+ {
378
+ checkPropTypes(typeSpecs, values, location, 'Component', ReactDebugCurrentFrame$1.getCurrentStack);
379
+ }
380
+ }
381
+
382
+ function validateContextBounds(context, threadID) {
383
+ // If we don't have enough slots in this context to store this threadID,
384
+ // fill it in without leaving any holes to ensure that the VM optimizes
385
+ // this as non-holey index properties.
386
+ for (var i = context._threadCount; i <= threadID; i++) {
387
+ // We assume that this is the same as the defaultValue which might not be
388
+ // true if we're rendering inside a secondary renderer but they are
389
+ // secondary because these use cases are very rare.
390
+ context[i] = context._currentValue2;
391
+ context._threadCount = i + 1;
392
+ }
393
+ }
394
+
395
+ function processContext(type, context, threadID) {
396
+ var contextType = type.contextType;
397
+ if (typeof contextType === 'object' && contextType !== null) {
398
+ {
399
+ if (contextType.$$typeof !== REACT_CONTEXT_TYPE) {
400
+ var name = getComponentName(type) || 'Component';
401
+ if (!didWarnAboutInvalidateContextType[name]) {
402
+ didWarnAboutInvalidateContextType[name] = true;
403
+ warningWithoutStack$1(false, '%s defines an invalid contextType. ' + 'contextType should point to the Context object returned by React.createContext(). ' + 'Did you accidentally pass the Context.Provider instead?', name);
404
+ }
405
+ }
406
+ }
407
+ validateContextBounds(contextType, threadID);
408
+ return contextType[threadID];
409
+ } else {
410
+ var maskedContext = maskContext(type, context);
411
+ {
412
+ if (type.contextTypes) {
413
+ checkContextTypes(type.contextTypes, maskedContext, 'context');
414
+ }
415
+ }
416
+ return maskedContext;
417
+ }
418
+ }
419
+
420
+ // Allocates a new index for each request. Tries to stay as compact as possible so that these
421
+ // indices can be used to reference a tightly packaged array. As opposed to being used in a Map.
422
+ // The first allocated index is 1.
423
+
424
+ var nextAvailableThreadIDs = new Uint16Array(16);
425
+ for (var i = 0; i < 15; i++) {
426
+ nextAvailableThreadIDs[i] = i + 1;
427
+ }
428
+ nextAvailableThreadIDs[15] = 0;
429
+
430
+ function growThreadCountAndReturnNextAvailable() {
431
+ var oldArray = nextAvailableThreadIDs;
432
+ var oldSize = oldArray.length;
433
+ var newSize = oldSize * 2;
434
+ !(newSize <= 0x10000) ? invariant(false, 'Maximum number of concurrent React renderers exceeded. This can happen if you are not properly destroying the Readable provided by React. Ensure that you call .destroy() on it if you no longer want to read from it, and did not read to the end. If you use .pipe() this should be automatic.') : void 0;
435
+ var newArray = new Uint16Array(newSize);
436
+ newArray.set(oldArray);
437
+ nextAvailableThreadIDs = newArray;
438
+ nextAvailableThreadIDs[0] = oldSize + 1;
439
+ for (var _i = oldSize; _i < newSize - 1; _i++) {
440
+ nextAvailableThreadIDs[_i] = _i + 1;
441
+ }
442
+ nextAvailableThreadIDs[newSize - 1] = 0;
443
+ return oldSize;
444
+ }
445
+
446
+ function allocThreadID() {
447
+ var nextID = nextAvailableThreadIDs[0];
448
+ if (nextID === 0) {
449
+ return growThreadCountAndReturnNextAvailable();
450
+ }
451
+ nextAvailableThreadIDs[0] = nextAvailableThreadIDs[nextID];
452
+ return nextID;
453
+ }
454
+
455
+ function freeThreadID(id) {
456
+ nextAvailableThreadIDs[id] = nextAvailableThreadIDs[0];
457
+ nextAvailableThreadIDs[0] = id;
458
+ }
459
+
379
460
  // A reserved attribute.
380
461
  // It is handled by React separately and shouldn't be written to the DOM.
381
462
  var RESERVED = 0;
@@ -682,7 +763,7 @@ function escapeHtml(string) {
682
763
 
683
764
  var escape = void 0;
684
765
  var html = '';
685
- var index = 0;
766
+ var index = void 0;
686
767
  var lastIndex = 0;
687
768
 
688
769
  for (index = match.index; index < str.length; index++) {
@@ -809,6 +890,297 @@ function createMarkupForCustomAttribute(name, value) {
809
890
  return name + '=' + quoteAttributeValueForBrowser(value);
810
891
  }
811
892
 
893
+ function areHookInputsEqual(arr1, arr2) {
894
+ // Don't bother comparing lengths in prod because these arrays should be
895
+ // passed inline.
896
+ {
897
+ !(arr1.length === arr2.length) ? warning$1(false, 'Detected a variable number of hook dependencies. The length of the ' + 'dependencies array should be constant between renders.\n\n' + 'Previous: %s\n' + 'Incoming: %s', arr1.join(', '), arr2.join(', ')) : void 0;
898
+ }
899
+ for (var i = 0; i < arr1.length; i++) {
900
+ // Inlined Object.is polyfill.
901
+ // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is
902
+ var val1 = arr1[i];
903
+ var val2 = arr2[i];
904
+ if (val1 === val2 && (val1 !== 0 || 1 / val1 === 1 / val2) || val1 !== val1 && val2 !== val2 // eslint-disable-line no-self-compare
905
+ ) {
906
+ continue;
907
+ }
908
+ return false;
909
+ }
910
+ return true;
911
+ }
912
+
913
+ var currentlyRenderingComponent = null;
914
+ var firstWorkInProgressHook = null;
915
+ var workInProgressHook = null;
916
+ // Whether the work-in-progress hook is a re-rendered hook
917
+ var isReRender = false;
918
+ // Whether an update was scheduled during the currently executing render pass.
919
+ var didScheduleRenderPhaseUpdate = false;
920
+ // Lazily created map of render-phase updates
921
+ var renderPhaseUpdates = null;
922
+ // Counter to prevent infinite loops.
923
+ var numberOfReRenders = 0;
924
+ var RE_RENDER_LIMIT = 25;
925
+
926
+ function resolveCurrentlyRenderingComponent() {
927
+ !(currentlyRenderingComponent !== null) ? invariant(false, 'Hooks can only be called inside the body of a function component.') : void 0;
928
+ return currentlyRenderingComponent;
929
+ }
930
+
931
+ function createHook() {
932
+ return {
933
+ memoizedState: null,
934
+ queue: null,
935
+ next: null
936
+ };
937
+ }
938
+
939
+ function createWorkInProgressHook() {
940
+ if (workInProgressHook === null) {
941
+ // This is the first hook in the list
942
+ if (firstWorkInProgressHook === null) {
943
+ isReRender = false;
944
+ firstWorkInProgressHook = workInProgressHook = createHook();
945
+ } else {
946
+ // There's already a work-in-progress. Reuse it.
947
+ isReRender = true;
948
+ workInProgressHook = firstWorkInProgressHook;
949
+ }
950
+ } else {
951
+ if (workInProgressHook.next === null) {
952
+ isReRender = false;
953
+ // Append to the end of the list
954
+ workInProgressHook = workInProgressHook.next = createHook();
955
+ } else {
956
+ // There's already a work-in-progress. Reuse it.
957
+ isReRender = true;
958
+ workInProgressHook = workInProgressHook.next;
959
+ }
960
+ }
961
+ return workInProgressHook;
962
+ }
963
+
964
+ function prepareToUseHooks(componentIdentity) {
965
+ currentlyRenderingComponent = componentIdentity;
966
+
967
+ // The following should have already been reset
968
+ // didScheduleRenderPhaseUpdate = false;
969
+ // firstWorkInProgressHook = null;
970
+ // numberOfReRenders = 0;
971
+ // renderPhaseUpdates = null;
972
+ // workInProgressHook = null;
973
+ }
974
+
975
+ function finishHooks(Component, props, children, refOrContext) {
976
+ // This must be called after every function component to prevent hooks from
977
+ // being used in classes.
978
+
979
+ while (didScheduleRenderPhaseUpdate) {
980
+ // Updates were scheduled during the render phase. They are stored in
981
+ // the `renderPhaseUpdates` map. Call the component again, reusing the
982
+ // work-in-progress hooks and applying the additional updates on top. Keep
983
+ // restarting until no more updates are scheduled.
984
+ didScheduleRenderPhaseUpdate = false;
985
+ numberOfReRenders += 1;
986
+
987
+ // Start over from the beginning of the list
988
+ workInProgressHook = null;
989
+
990
+ children = Component(props, refOrContext);
991
+ }
992
+ currentlyRenderingComponent = null;
993
+ firstWorkInProgressHook = null;
994
+ numberOfReRenders = 0;
995
+ renderPhaseUpdates = null;
996
+ workInProgressHook = null;
997
+
998
+ // These were reset above
999
+ // currentlyRenderingComponent = null;
1000
+ // didScheduleRenderPhaseUpdate = false;
1001
+ // firstWorkInProgressHook = null;
1002
+ // numberOfReRenders = 0;
1003
+ // renderPhaseUpdates = null;
1004
+ // workInProgressHook = null;
1005
+
1006
+ return children;
1007
+ }
1008
+
1009
+ function readContext(context, observedBits) {
1010
+ var threadID = currentThreadID;
1011
+ validateContextBounds(context, threadID);
1012
+ return context[threadID];
1013
+ }
1014
+
1015
+ function useContext(context, observedBits) {
1016
+ resolveCurrentlyRenderingComponent();
1017
+ var threadID = currentThreadID;
1018
+ validateContextBounds(context, threadID);
1019
+ return context[threadID];
1020
+ }
1021
+
1022
+ function basicStateReducer(state, action) {
1023
+ return typeof action === 'function' ? action(state) : action;
1024
+ }
1025
+
1026
+ function useState(initialState) {
1027
+ return useReducer(basicStateReducer,
1028
+ // useReducer has a special case to support lazy useState initializers
1029
+ initialState);
1030
+ }
1031
+
1032
+ function useReducer(reducer, initialState, initialAction) {
1033
+ currentlyRenderingComponent = resolveCurrentlyRenderingComponent();
1034
+ workInProgressHook = createWorkInProgressHook();
1035
+ if (isReRender) {
1036
+ // This is a re-render. Apply the new render phase updates to the previous
1037
+ var _queue = workInProgressHook.queue;
1038
+ var _dispatch = _queue.dispatch;
1039
+ if (renderPhaseUpdates !== null) {
1040
+ // Render phase updates are stored in a map of queue -> linked list
1041
+ var firstRenderPhaseUpdate = renderPhaseUpdates.get(_queue);
1042
+ if (firstRenderPhaseUpdate !== undefined) {
1043
+ renderPhaseUpdates.delete(_queue);
1044
+ var newState = workInProgressHook.memoizedState;
1045
+ var update = firstRenderPhaseUpdate;
1046
+ do {
1047
+ // Process this render phase update. We don't have to check the
1048
+ // priority because it will always be the same as the current
1049
+ // render's.
1050
+ var _action = update.action;
1051
+ newState = reducer(newState, _action);
1052
+ update = update.next;
1053
+ } while (update !== null);
1054
+
1055
+ workInProgressHook.memoizedState = newState;
1056
+
1057
+ return [newState, _dispatch];
1058
+ }
1059
+ }
1060
+ return [workInProgressHook.memoizedState, _dispatch];
1061
+ } else {
1062
+ if (reducer === basicStateReducer) {
1063
+ // Special case for `useState`.
1064
+ if (typeof initialState === 'function') {
1065
+ initialState = initialState();
1066
+ }
1067
+ } else if (initialAction !== undefined && initialAction !== null) {
1068
+ initialState = reducer(initialState, initialAction);
1069
+ }
1070
+ workInProgressHook.memoizedState = initialState;
1071
+ var _queue2 = workInProgressHook.queue = {
1072
+ last: null,
1073
+ dispatch: null
1074
+ };
1075
+ var _dispatch2 = _queue2.dispatch = dispatchAction.bind(null, currentlyRenderingComponent, _queue2);
1076
+ return [workInProgressHook.memoizedState, _dispatch2];
1077
+ }
1078
+ }
1079
+
1080
+ function useMemo(nextCreate, inputs) {
1081
+ currentlyRenderingComponent = resolveCurrentlyRenderingComponent();
1082
+ workInProgressHook = createWorkInProgressHook();
1083
+
1084
+ var nextInputs = inputs !== undefined && inputs !== null ? inputs : [nextCreate];
1085
+
1086
+ if (workInProgressHook !== null && workInProgressHook.memoizedState !== null) {
1087
+ var prevState = workInProgressHook.memoizedState;
1088
+ var prevInputs = prevState[1];
1089
+ if (areHookInputsEqual(nextInputs, prevInputs)) {
1090
+ return prevState[0];
1091
+ }
1092
+ }
1093
+
1094
+ var nextValue = nextCreate();
1095
+ workInProgressHook.memoizedState = [nextValue, nextInputs];
1096
+ return nextValue;
1097
+ }
1098
+
1099
+ function useRef(initialValue) {
1100
+ currentlyRenderingComponent = resolveCurrentlyRenderingComponent();
1101
+ workInProgressHook = createWorkInProgressHook();
1102
+ var previousRef = workInProgressHook.memoizedState;
1103
+ if (previousRef === null) {
1104
+ var ref = { current: initialValue };
1105
+ {
1106
+ Object.seal(ref);
1107
+ }
1108
+ workInProgressHook.memoizedState = ref;
1109
+ return ref;
1110
+ } else {
1111
+ return previousRef;
1112
+ }
1113
+ }
1114
+
1115
+ function useMutationEffect(create, inputs) {
1116
+ warning$1(false, 'useMutationEffect does nothing on the server, because its effect cannot ' + "be encoded into the server renderer's output format. This will lead " + 'to a mismatch between the initial, non-hydrated UI and the intended ' + 'UI. To avoid this, useMutationEffect should only be used in ' + 'components that render exclusively on the client.');
1117
+ }
1118
+
1119
+ function useLayoutEffect(create, inputs) {
1120
+ warning$1(false, 'useLayoutEffect does nothing on the server, because its effect cannot ' + "be encoded into the server renderer's output format. This will lead " + 'to a mismatch between the initial, non-hydrated UI and the intended ' + 'UI. To avoid this, useLayoutEffect should only be used in ' + 'components that render exclusively on the client.');
1121
+ }
1122
+
1123
+ function dispatchAction(componentIdentity, queue, action) {
1124
+ !(numberOfReRenders < RE_RENDER_LIMIT) ? invariant(false, 'Too many re-renders. React limits the number of renders to prevent an infinite loop.') : void 0;
1125
+
1126
+ if (componentIdentity === currentlyRenderingComponent) {
1127
+ // This is a render phase update. Stash it in a lazily-created map of
1128
+ // queue -> linked list of updates. After this render pass, we'll restart
1129
+ // and apply the stashed updates on top of the work-in-progress hook.
1130
+ didScheduleRenderPhaseUpdate = true;
1131
+ var update = {
1132
+ action: action,
1133
+ next: null
1134
+ };
1135
+ if (renderPhaseUpdates === null) {
1136
+ renderPhaseUpdates = new Map();
1137
+ }
1138
+ var firstRenderPhaseUpdate = renderPhaseUpdates.get(queue);
1139
+ if (firstRenderPhaseUpdate === undefined) {
1140
+ renderPhaseUpdates.set(queue, update);
1141
+ } else {
1142
+ // Append the update to the end of the list.
1143
+ var lastRenderPhaseUpdate = firstRenderPhaseUpdate;
1144
+ while (lastRenderPhaseUpdate.next !== null) {
1145
+ lastRenderPhaseUpdate = lastRenderPhaseUpdate.next;
1146
+ }
1147
+ lastRenderPhaseUpdate.next = update;
1148
+ }
1149
+ } else {
1150
+ // This means an update has happened after the function component has
1151
+ // returned. On the server this is a no-op. In React Fiber, the update
1152
+ // would be scheduled for a future render.
1153
+ }
1154
+ }
1155
+
1156
+ function noop() {}
1157
+
1158
+ var currentThreadID = 0;
1159
+
1160
+ function setCurrentThreadID(threadID) {
1161
+ currentThreadID = threadID;
1162
+ }
1163
+
1164
+ var Dispatcher = {
1165
+ readContext: readContext,
1166
+ useContext: useContext,
1167
+ useMemo: useMemo,
1168
+ useReducer: useReducer,
1169
+ useRef: useRef,
1170
+ useState: useState,
1171
+ useMutationEffect: useMutationEffect,
1172
+ useLayoutEffect: useLayoutEffect,
1173
+ // useImperativeMethods is not run in the server environment
1174
+ useImperativeMethods: noop,
1175
+ // Callbacks are not run in the server environment.
1176
+ useCallback: noop,
1177
+ // Effects are not run in the server environment.
1178
+ useEffect: noop
1179
+ };
1180
+ var DispatcherWithoutHooks = {
1181
+ readContext: readContext
1182
+ };
1183
+
812
1184
  var HTML_NAMESPACE = 'http://www.w3.org/1999/xhtml';
813
1185
  var MATH_NAMESPACE = 'http://www.w3.org/1998/Math/MathML';
814
1186
  var SVG_NAMESPACE = 'http://www.w3.org/2000/svg';
@@ -844,14 +1216,14 @@ function getChildNamespace(parentNamespace, type) {
844
1216
  return parentNamespace;
845
1217
  }
846
1218
 
847
- var ReactDebugCurrentFrame$1 = null;
1219
+ var ReactDebugCurrentFrame$2 = null;
848
1220
 
849
1221
  var ReactControlledValuePropTypes = {
850
1222
  checkPropTypes: null
851
1223
  };
852
1224
 
853
1225
  {
854
- ReactDebugCurrentFrame$1 = ReactSharedInternals.ReactDebugCurrentFrame;
1226
+ ReactDebugCurrentFrame$2 = ReactSharedInternals.ReactDebugCurrentFrame;
855
1227
 
856
1228
  var hasReadOnlyValue = {
857
1229
  button: true,
@@ -883,7 +1255,7 @@ var ReactControlledValuePropTypes = {
883
1255
  * this outside of the ReactDOM controlled form components.
884
1256
  */
885
1257
  ReactControlledValuePropTypes.checkPropTypes = function (tagName, props) {
886
- checkPropTypes(propTypes, props, 'prop', tagName, ReactDebugCurrentFrame$1.getStackAddendum);
1258
+ checkPropTypes(propTypes, props, 'prop', tagName, ReactDebugCurrentFrame$2.getStackAddendum);
887
1259
  };
888
1260
  }
889
1261
 
@@ -920,9 +1292,9 @@ var voidElementTags = _assign({
920
1292
  // or add stack by default to invariants where possible.
921
1293
  var HTML = '__html';
922
1294
 
923
- var ReactDebugCurrentFrame$2 = null;
1295
+ var ReactDebugCurrentFrame$3 = null;
924
1296
  {
925
- ReactDebugCurrentFrame$2 = ReactSharedInternals.ReactDebugCurrentFrame;
1297
+ ReactDebugCurrentFrame$3 = ReactSharedInternals.ReactDebugCurrentFrame;
926
1298
  }
927
1299
 
928
1300
  function assertValidProps(tag, props) {
@@ -931,7 +1303,7 @@ function assertValidProps(tag, props) {
931
1303
  }
932
1304
  // Note the use of `==` which checks for null or undefined.
933
1305
  if (voidElementTags[tag]) {
934
- !(props.children == null && props.dangerouslySetInnerHTML == null) ? invariant(false, '%s is a void element tag and must neither have `children` nor use `dangerouslySetInnerHTML`.%s', tag, ReactDebugCurrentFrame$2.getStackAddendum()) : void 0;
1306
+ !(props.children == null && props.dangerouslySetInnerHTML == null) ? invariant(false, '%s is a void element tag and must neither have `children` nor use `dangerouslySetInnerHTML`.%s', tag, ReactDebugCurrentFrame$3.getStackAddendum()) : void 0;
935
1307
  }
936
1308
  if (props.dangerouslySetInnerHTML != null) {
937
1309
  !(props.children == null) ? invariant(false, 'Can only set one of `children` or `props.dangerouslySetInnerHTML`.') : void 0;
@@ -940,7 +1312,7 @@ function assertValidProps(tag, props) {
940
1312
  {
941
1313
  !(props.suppressContentEditableWarning || !props.contentEditable || props.children == null) ? warning$1(false, 'A component is `contentEditable` and contains `children` managed by ' + 'React. It is now your responsibility to guarantee that none of ' + 'those nodes are unexpectedly modified or duplicated. This is ' + 'probably not intentional.') : void 0;
942
1314
  }
943
- !(props.style == null || typeof props.style === 'object') ? invariant(false, 'The `style` prop expects a mapping from style properties to values, not a string. For example, style={{marginRight: spacing + \'em\'}} when using JSX.%s', ReactDebugCurrentFrame$2.getStackAddendum()) : void 0;
1315
+ !(props.style == null || typeof props.style === 'object') ? invariant(false, 'The `style` prop expects a mapping from style properties to values, not a string. For example, style={{marginRight: spacing + \'em\'}} when using JSX.%s', ReactDebugCurrentFrame$3.getStackAddendum()) : void 0;
944
1316
  }
945
1317
 
946
1318
  /**
@@ -2049,6 +2421,7 @@ var toArray = React.Children.toArray;
2049
2421
  // Each stack is an array of frames which may contain nested stacks of elements.
2050
2422
  var currentDebugStacks = [];
2051
2423
 
2424
+ var ReactCurrentOwner = ReactSharedInternals.ReactCurrentOwner;
2052
2425
  var ReactDebugCurrentFrame = void 0;
2053
2426
  var prevGetCurrentStackImpl = null;
2054
2427
  var getCurrentServerStackImpl = function () {
@@ -2062,6 +2435,7 @@ var validatePropertiesInDevelopment = function (type, props) {};
2062
2435
  var pushCurrentDebugStack = function (stack) {};
2063
2436
  var pushElementToDebugStack = function (element) {};
2064
2437
  var popCurrentDebugStack = function () {};
2438
+ var hasWarnedAboutUsingContextAsConsumer = false;
2065
2439
 
2066
2440
  {
2067
2441
  ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;
@@ -2272,39 +2646,6 @@ function flattenOptionChildren(children) {
2272
2646
  return content;
2273
2647
  }
2274
2648
 
2275
- var emptyObject = {};
2276
- {
2277
- Object.freeze(emptyObject);
2278
- }
2279
-
2280
- function maskContext(type, context) {
2281
- var contextTypes = type.contextTypes;
2282
- if (!contextTypes) {
2283
- return emptyObject;
2284
- }
2285
- var maskedContext = {};
2286
- for (var contextName in contextTypes) {
2287
- maskedContext[contextName] = context[contextName];
2288
- }
2289
- return maskedContext;
2290
- }
2291
-
2292
- function checkContextTypes(typeSpecs, values, location) {
2293
- {
2294
- checkPropTypes(typeSpecs, values, location, 'Component', getCurrentServerStackImpl);
2295
- }
2296
- }
2297
-
2298
- function processContext(type, context) {
2299
- var maskedContext = maskContext(type, context);
2300
- {
2301
- if (type.contextTypes) {
2302
- checkContextTypes(type.contextTypes, maskedContext, 'context');
2303
- }
2304
- }
2305
- return maskedContext;
2306
- }
2307
-
2308
2649
  var hasOwnProperty = Object.prototype.hasOwnProperty;
2309
2650
  var STYLE = 'style';
2310
2651
  var RESERVED_PROPS = {
@@ -2359,7 +2700,7 @@ function validateRenderResult(child, type) {
2359
2700
  }
2360
2701
  }
2361
2702
 
2362
- function resolve(child, context) {
2703
+ function resolve(child, context, threadID) {
2363
2704
  while (React.isValidElement(child)) {
2364
2705
  // Safe because we just checked it's an element.
2365
2706
  var element = child;
@@ -2375,7 +2716,7 @@ function resolve(child, context) {
2375
2716
 
2376
2717
  // Extra closure so queue and replace can be captured properly
2377
2718
  function processChild(element, Component) {
2378
- var publicContext = processContext(Component, context);
2719
+ var publicContext = processContext(Component, context, threadID);
2379
2720
 
2380
2721
  var queue = [];
2381
2722
  var replace = false;
@@ -2444,7 +2785,11 @@ function resolve(child, context) {
2444
2785
  }
2445
2786
  }
2446
2787
  }
2788
+ var componentIdentity = {};
2789
+ prepareToUseHooks(componentIdentity);
2447
2790
  inst = Component(element.props, publicContext, updater);
2791
+ inst = finishHooks(Component, element.props, inst, publicContext);
2792
+
2448
2793
  if (inst == null || inst.render == null) {
2449
2794
  child = inst;
2450
2795
  validateRenderResult(child, Component);
@@ -2546,6 +2891,7 @@ function resolve(child, context) {
2546
2891
  var ReactDOMServerRenderer = function () {
2547
2892
  // DEV-only
2548
2893
 
2894
+ // TODO: type this more strictly:
2549
2895
  function ReactDOMServerRenderer(children, makeStaticMarkup) {
2550
2896
  _classCallCheck(this, ReactDOMServerRenderer);
2551
2897
 
@@ -2564,11 +2910,13 @@ var ReactDOMServerRenderer = function () {
2564
2910
  {
2565
2911
  topFrame.debugElementStack = [];
2566
2912
  }
2913
+ this.threadID = allocThreadID();
2567
2914
  this.stack = [topFrame];
2568
2915
  this.exhausted = false;
2569
2916
  this.currentSelectValue = null;
2570
2917
  this.previousWasTextNode = false;
2571
2918
  this.makeStaticMarkup = makeStaticMarkup;
2919
+ this.suspenseDepth = 0;
2572
2920
 
2573
2921
  // Context (new API)
2574
2922
  this.contextIndex = -1;
@@ -2579,6 +2927,13 @@ var ReactDOMServerRenderer = function () {
2579
2927
  }
2580
2928
  }
2581
2929
 
2930
+ ReactDOMServerRenderer.prototype.destroy = function destroy() {
2931
+ if (!this.exhausted) {
2932
+ this.exhausted = true;
2933
+ freeThreadID(this.threadID);
2934
+ }
2935
+ };
2936
+
2582
2937
  /**
2583
2938
  * Note: We use just two stacks regardless of how many context providers you have.
2584
2939
  * Providers are always popped in the reverse order to how they were pushed
@@ -2589,13 +2944,12 @@ var ReactDOMServerRenderer = function () {
2589
2944
  * https://github.com/facebook/react/pull/12985#issuecomment-396301248
2590
2945
  */
2591
2946
 
2592
- // TODO: type this more strictly:
2593
-
2594
-
2595
2947
  ReactDOMServerRenderer.prototype.pushProvider = function pushProvider(provider) {
2596
2948
  var index = ++this.contextIndex;
2597
2949
  var context = provider.type._context;
2598
- var previousValue = context._currentValue;
2950
+ var threadID = this.threadID;
2951
+ validateContextBounds(context, threadID);
2952
+ var previousValue = context[threadID];
2599
2953
 
2600
2954
  // Remember which value to restore this context to on our way up.
2601
2955
  this.contextStack[index] = context;
@@ -2606,7 +2960,7 @@ var ReactDOMServerRenderer = function () {
2606
2960
  }
2607
2961
 
2608
2962
  // Mutate the current value.
2609
- context._currentValue = provider.props.value;
2963
+ context[threadID] = provider.props.value;
2610
2964
  };
2611
2965
 
2612
2966
  ReactDOMServerRenderer.prototype.popProvider = function popProvider(provider) {
@@ -2629,7 +2983,9 @@ var ReactDOMServerRenderer = function () {
2629
2983
  this.contextIndex--;
2630
2984
 
2631
2985
  // Restore to the previous value we stored as we were walking down.
2632
- context._currentValue = previousValue;
2986
+ // We've already verified that this context has been expanded to accommodate
2987
+ // this thread id, so we don't need to do it again.
2988
+ context[this.threadID] = previousValue;
2633
2989
  };
2634
2990
 
2635
2991
  ReactDOMServerRenderer.prototype.read = function read(bytes) {
@@ -2637,42 +2993,89 @@ var ReactDOMServerRenderer = function () {
2637
2993
  return null;
2638
2994
  }
2639
2995
 
2640
- var out = '';
2641
- while (out.length < bytes) {
2642
- if (this.stack.length === 0) {
2643
- this.exhausted = true;
2644
- break;
2645
- }
2646
- var frame = this.stack[this.stack.length - 1];
2647
- if (frame.childIndex >= frame.children.length) {
2648
- var _footer = frame.footer;
2649
- out += _footer;
2650
- if (_footer !== '') {
2651
- this.previousWasTextNode = false;
2996
+ var prevThreadID = currentThreadID;
2997
+ setCurrentThreadID(this.threadID);
2998
+ var prevDispatcher = ReactCurrentOwner.currentDispatcher;
2999
+ if (enableHooks) {
3000
+ ReactCurrentOwner.currentDispatcher = Dispatcher;
3001
+ } else {
3002
+ ReactCurrentOwner.currentDispatcher = DispatcherWithoutHooks;
3003
+ }
3004
+ try {
3005
+ // Markup generated within <Suspense> ends up buffered until we know
3006
+ // nothing in that boundary suspended
3007
+ var out = [''];
3008
+ var suspended = false;
3009
+ while (out[0].length < bytes) {
3010
+ if (this.stack.length === 0) {
3011
+ this.exhausted = true;
3012
+ freeThreadID(this.threadID);
3013
+ break;
2652
3014
  }
2653
- this.stack.pop();
2654
- if (frame.type === 'select') {
2655
- this.currentSelectValue = null;
2656
- } else if (frame.type != null && frame.type.type != null && frame.type.type.$$typeof === REACT_PROVIDER_TYPE) {
2657
- var provider = frame.type;
2658
- this.popProvider(provider);
3015
+ var frame = this.stack[this.stack.length - 1];
3016
+ if (suspended || frame.childIndex >= frame.children.length) {
3017
+ var _footer = frame.footer;
3018
+ if (_footer !== '') {
3019
+ this.previousWasTextNode = false;
3020
+ }
3021
+ this.stack.pop();
3022
+ if (frame.type === 'select') {
3023
+ this.currentSelectValue = null;
3024
+ } else if (frame.type != null && frame.type.type != null && frame.type.type.$$typeof === REACT_PROVIDER_TYPE) {
3025
+ var provider = frame.type;
3026
+ this.popProvider(provider);
3027
+ } else if (frame.type === REACT_SUSPENSE_TYPE) {
3028
+ this.suspenseDepth--;
3029
+ var buffered = out.pop();
3030
+
3031
+ if (suspended) {
3032
+ suspended = false;
3033
+ // If rendering was suspended at this boundary, render the fallbackFrame
3034
+ var _fallbackFrame = frame.fallbackFrame;
3035
+ !_fallbackFrame ? invariant(false, 'suspense fallback not found, something is broken') : void 0;
3036
+ this.stack.push(_fallbackFrame);
3037
+ // Skip flushing output since we're switching to the fallback
3038
+ continue;
3039
+ } else {
3040
+ out[this.suspenseDepth] += buffered;
3041
+ }
3042
+ }
3043
+
3044
+ // Flush output
3045
+ out[this.suspenseDepth] += _footer;
3046
+ continue;
3047
+ }
3048
+ var child = frame.children[frame.childIndex++];
3049
+
3050
+ var outBuffer = '';
3051
+ {
3052
+ pushCurrentDebugStack(this.stack);
3053
+ // We're starting work on this frame, so reset its inner stack.
3054
+ frame.debugElementStack.length = 0;
2659
3055
  }
2660
- continue;
2661
- }
2662
- var child = frame.children[frame.childIndex++];
2663
- {
2664
- pushCurrentDebugStack(this.stack);
2665
- // We're starting work on this frame, so reset its inner stack.
2666
- frame.debugElementStack.length = 0;
2667
3056
  try {
2668
- // Be careful! Make sure this matches the PROD path below.
2669
- out += this.render(child, frame.context, frame.domNamespace);
3057
+ outBuffer += this.render(child, frame.context, frame.domNamespace);
3058
+ } catch (err) {
3059
+ if (enableSuspenseServerRenderer && typeof err.then === 'function') {
3060
+ suspended = true;
3061
+ } else {
3062
+ throw err;
3063
+ }
2670
3064
  } finally {
2671
- popCurrentDebugStack();
3065
+ {
3066
+ popCurrentDebugStack();
3067
+ }
3068
+ }
3069
+ if (out.length <= this.suspenseDepth) {
3070
+ out.push('');
2672
3071
  }
3072
+ out[this.suspenseDepth] += outBuffer;
2673
3073
  }
3074
+ return out[0];
3075
+ } finally {
3076
+ ReactCurrentOwner.currentDispatcher = prevDispatcher;
3077
+ setCurrentThreadID(prevThreadID);
2674
3078
  }
2675
- return out;
2676
3079
  };
2677
3080
 
2678
3081
  ReactDOMServerRenderer.prototype.render = function render(child, context, parentNamespace) {
@@ -2692,7 +3095,7 @@ var ReactDOMServerRenderer = function () {
2692
3095
  } else {
2693
3096
  var nextChild = void 0;
2694
3097
 
2695
- var _resolve = resolve(child, context);
3098
+ var _resolve = resolve(child, context, this.threadID);
2696
3099
 
2697
3100
  nextChild = _resolve.child;
2698
3101
  context = _resolve.context;
@@ -2754,12 +3157,21 @@ var ReactDOMServerRenderer = function () {
2754
3157
  case REACT_SUSPENSE_TYPE:
2755
3158
  {
2756
3159
  if (enableSuspenseServerRenderer) {
2757
- var _nextChildren2 = toArray(
2758
- // Always use the fallback when synchronously rendering to string.
2759
- nextChild.props.fallback);
2760
- var _frame2 = {
3160
+ var fallbackChildren = toArray(nextChild.props.fallback);
3161
+ var _nextChildren2 = toArray(nextChild.props.children);
3162
+ var _fallbackFrame2 = {
2761
3163
  type: null,
2762
3164
  domNamespace: parentNamespace,
3165
+ children: fallbackChildren,
3166
+ childIndex: 0,
3167
+ context: context,
3168
+ footer: '',
3169
+ out: ''
3170
+ };
3171
+ var _frame2 = {
3172
+ fallbackFrame: _fallbackFrame2,
3173
+ type: REACT_SUSPENSE_TYPE,
3174
+ domNamespace: parentNamespace,
2763
3175
  children: _nextChildren2,
2764
3176
  childIndex: 0,
2765
3177
  context: context,
@@ -2767,9 +3179,13 @@ var ReactDOMServerRenderer = function () {
2767
3179
  };
2768
3180
  {
2769
3181
  _frame2.debugElementStack = [];
3182
+ _fallbackFrame2.debugElementStack = [];
2770
3183
  }
2771
3184
  this.stack.push(_frame2);
3185
+ this.suspenseDepth++;
2772
3186
  return '';
3187
+ } else {
3188
+ invariant(false, 'ReactDOMServer does not yet support Suspense.');
2773
3189
  }
2774
3190
  }
2775
3191
  // eslint-disable-next-line-no-fallthrough
@@ -2781,7 +3197,12 @@ var ReactDOMServerRenderer = function () {
2781
3197
  case REACT_FORWARD_REF_TYPE:
2782
3198
  {
2783
3199
  var element = nextChild;
2784
- var _nextChildren3 = toArray(elementType.render(element.props, element.ref));
3200
+ var _nextChildren3 = void 0;
3201
+ var componentIdentity = {};
3202
+ prepareToUseHooks(componentIdentity);
3203
+ _nextChildren3 = elementType.render(element.props, element.ref);
3204
+ _nextChildren3 = finishHooks(elementType.render, element.props, _nextChildren3, element.ref);
3205
+ _nextChildren3 = toArray(_nextChildren3);
2785
3206
  var _frame3 = {
2786
3207
  type: null,
2787
3208
  domNamespace: parentNamespace,
@@ -2796,51 +3217,93 @@ var ReactDOMServerRenderer = function () {
2796
3217
  this.stack.push(_frame3);
2797
3218
  return '';
2798
3219
  }
3220
+ case REACT_MEMO_TYPE:
3221
+ {
3222
+ var _element = nextChild;
3223
+ var _nextChildren4 = [React.createElement(elementType.type, _assign({ ref: _element.ref }, _element.props))];
3224
+ var _frame4 = {
3225
+ type: null,
3226
+ domNamespace: parentNamespace,
3227
+ children: _nextChildren4,
3228
+ childIndex: 0,
3229
+ context: context,
3230
+ footer: ''
3231
+ };
3232
+ {
3233
+ _frame4.debugElementStack = [];
3234
+ }
3235
+ this.stack.push(_frame4);
3236
+ return '';
3237
+ }
2799
3238
  case REACT_PROVIDER_TYPE:
2800
3239
  {
2801
3240
  var provider = nextChild;
2802
3241
  var nextProps = provider.props;
2803
- var _nextChildren4 = toArray(nextProps.children);
2804
- var _frame4 = {
3242
+ var _nextChildren5 = toArray(nextProps.children);
3243
+ var _frame5 = {
2805
3244
  type: provider,
2806
3245
  domNamespace: parentNamespace,
2807
- children: _nextChildren4,
3246
+ children: _nextChildren5,
2808
3247
  childIndex: 0,
2809
3248
  context: context,
2810
3249
  footer: ''
2811
3250
  };
2812
3251
  {
2813
- _frame4.debugElementStack = [];
3252
+ _frame5.debugElementStack = [];
2814
3253
  }
2815
3254
 
2816
3255
  this.pushProvider(provider);
2817
3256
 
2818
- this.stack.push(_frame4);
3257
+ this.stack.push(_frame5);
2819
3258
  return '';
2820
3259
  }
2821
3260
  case REACT_CONTEXT_TYPE:
2822
3261
  {
2823
- var consumer = nextChild;
2824
- var _nextProps = consumer.props;
2825
- var nextValue = consumer.type._currentValue;
3262
+ var reactContext = nextChild.type;
3263
+ // The logic below for Context differs depending on PROD or DEV mode. In
3264
+ // DEV mode, we create a separate object for Context.Consumer that acts
3265
+ // like a proxy to Context. This proxy object adds unnecessary code in PROD
3266
+ // so we use the old behaviour (Context.Consumer references Context) to
3267
+ // reduce size and overhead. The separate object references context via
3268
+ // a property called "_context", which also gives us the ability to check
3269
+ // in DEV mode if this property exists or not and warn if it does not.
3270
+ {
3271
+ if (reactContext._context === undefined) {
3272
+ // This may be because it's a Context (rather than a Consumer).
3273
+ // Or it may be because it's older React where they're the same thing.
3274
+ // We only want to warn if we're sure it's a new React.
3275
+ if (reactContext !== reactContext.Consumer) {
3276
+ if (!hasWarnedAboutUsingContextAsConsumer) {
3277
+ hasWarnedAboutUsingContextAsConsumer = true;
3278
+ warning$1(false, 'Rendering <Context> directly is not supported and will be removed in ' + 'a future major release. Did you mean to render <Context.Consumer> instead?');
3279
+ }
3280
+ }
3281
+ } else {
3282
+ reactContext = reactContext._context;
3283
+ }
3284
+ }
3285
+ var _nextProps = nextChild.props;
3286
+ var threadID = this.threadID;
3287
+ validateContextBounds(reactContext, threadID);
3288
+ var nextValue = reactContext[threadID];
2826
3289
 
2827
- var _nextChildren5 = toArray(_nextProps.children(nextValue));
2828
- var _frame5 = {
3290
+ var _nextChildren6 = toArray(_nextProps.children(nextValue));
3291
+ var _frame6 = {
2829
3292
  type: nextChild,
2830
3293
  domNamespace: parentNamespace,
2831
- children: _nextChildren5,
3294
+ children: _nextChildren6,
2832
3295
  childIndex: 0,
2833
3296
  context: context,
2834
3297
  footer: ''
2835
3298
  };
2836
3299
  {
2837
- _frame5.debugElementStack = [];
3300
+ _frame6.debugElementStack = [];
2838
3301
  }
2839
- this.stack.push(_frame5);
3302
+ this.stack.push(_frame6);
2840
3303
  return '';
2841
3304
  }
2842
- default:
2843
- break;
3305
+ case REACT_LAZY_TYPE:
3306
+ invariant(false, 'ReactDOMServer does not yet support lazy-loaded components.');
2844
3307
  }
2845
3308
  }
2846
3309
 
@@ -3057,8 +3520,12 @@ var ReactDOMServerRenderer = function () {
3057
3520
  */
3058
3521
  function renderToString(element) {
3059
3522
  var renderer = new ReactDOMServerRenderer(element, false);
3060
- var markup = renderer.read(Infinity);
3061
- return markup;
3523
+ try {
3524
+ var markup = renderer.read(Infinity);
3525
+ return markup;
3526
+ } finally {
3527
+ renderer.destroy();
3528
+ }
3062
3529
  }
3063
3530
 
3064
3531
  /**
@@ -3068,8 +3535,12 @@ function renderToString(element) {
3068
3535
  */
3069
3536
  function renderToStaticMarkup(element) {
3070
3537
  var renderer = new ReactDOMServerRenderer(element, true);
3071
- var markup = renderer.read(Infinity);
3072
- return markup;
3538
+ try {
3539
+ var markup = renderer.read(Infinity);
3540
+ return markup;
3541
+ } finally {
3542
+ renderer.destroy();
3543
+ }
3073
3544
  }
3074
3545
 
3075
3546
  function _classCallCheck$1(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
@@ -3095,11 +3566,15 @@ var ReactMarkupReadableStream = function (_Readable) {
3095
3566
  return _this;
3096
3567
  }
3097
3568
 
3569
+ ReactMarkupReadableStream.prototype._destroy = function _destroy() {
3570
+ this.partialRenderer.destroy();
3571
+ };
3572
+
3098
3573
  ReactMarkupReadableStream.prototype._read = function _read(size) {
3099
3574
  try {
3100
3575
  this.push(this.partialRenderer.read(size));
3101
3576
  } catch (err) {
3102
- this.emit('error', err);
3577
+ this.destroy(err);
3103
3578
  }
3104
3579
  };
3105
3580
 
@@ -3108,7 +3583,7 @@ var ReactMarkupReadableStream = function (_Readable) {
3108
3583
  /**
3109
3584
  * Render a ReactElement to its initial HTML. This should only be used on the
3110
3585
  * server.
3111
- * See https://reactjs.org/docs/react-dom-stream.html#rendertonodestream
3586
+ * See https://reactjs.org/docs/react-dom-server.html#rendertonodestream
3112
3587
  */
3113
3588
 
3114
3589
 
@@ -3119,7 +3594,7 @@ function renderToNodeStream(element) {
3119
3594
  /**
3120
3595
  * Similar to renderToNodeStream, except this doesn't create extra DOM attributes
3121
3596
  * such as data-react-id that React uses internally.
3122
- * See https://reactjs.org/docs/react-dom-stream.html#rendertostaticnodestream
3597
+ * See https://reactjs.org/docs/react-dom-server.html#rendertostaticnodestream
3123
3598
  */
3124
3599
  function renderToStaticNodeStream(element) {
3125
3600
  return new ReactMarkupReadableStream(element, true);