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