react-dom 16.8.5 → 16.9.0

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 (34) hide show
  1. package/build-info.json +5 -5
  2. package/cjs/react-dom-server.browser.development.js +473 -136
  3. package/cjs/react-dom-server.browser.production.min.js +45 -42
  4. package/cjs/react-dom-server.node.development.js +456 -131
  5. package/cjs/react-dom-server.node.production.min.js +46 -44
  6. package/cjs/react-dom-test-utils.development.js +328 -82
  7. package/cjs/react-dom-test-utils.production.min.js +26 -23
  8. package/cjs/react-dom-unstable-fizz.browser.development.js +9 -1
  9. package/cjs/react-dom-unstable-fizz.browser.production.min.js +1 -1
  10. package/cjs/react-dom-unstable-fizz.node.development.js +9 -1
  11. package/cjs/react-dom-unstable-fizz.node.production.min.js +1 -1
  12. package/cjs/react-dom-unstable-native-dependencies.development.js +67 -44
  13. package/cjs/react-dom-unstable-native-dependencies.production.min.js +20 -21
  14. package/cjs/react-dom.development.js +15465 -11493
  15. package/cjs/react-dom.production.min.js +266 -257
  16. package/cjs/react-dom.profiling.min.js +272 -263
  17. package/package.json +2 -2
  18. package/umd/react-dom-server.browser.development.js +473 -136
  19. package/umd/react-dom-server.browser.production.min.js +38 -37
  20. package/umd/react-dom-test-utils.development.js +349 -82
  21. package/umd/react-dom-test-utils.production.min.js +23 -22
  22. package/umd/react-dom-unstable-fizz.browser.development.js +9 -1
  23. package/umd/react-dom-unstable-fizz.browser.production.min.js +1 -1
  24. package/umd/react-dom-unstable-native-dependencies.development.js +67 -44
  25. package/umd/react-dom-unstable-native-dependencies.production.min.js +21 -22
  26. package/umd/react-dom.development.js +12006 -8031
  27. package/umd/react-dom.production.min.js +220 -209
  28. package/umd/react-dom.profiling.min.js +227 -214
  29. package/cjs/react-dom-unstable-fire.development.js +0 -21252
  30. package/cjs/react-dom-unstable-fire.production.min.js +0 -269
  31. package/cjs/react-dom-unstable-fire.profiling.min.js +0 -278
  32. package/umd/react-dom-unstable-fire.development.js +0 -21387
  33. package/umd/react-dom-unstable-fire.production.min.js +0 -220
  34. package/umd/react-dom-unstable-fire.profiling.min.js +0 -225
@@ -1,4 +1,4 @@
1
- /** @license React v16.8.5
1
+ /** @license React v16.9.0
2
2
  * react-dom-test-utils.development.js
3
3
  *
4
4
  * Copyright (c) Facebook, Inc. and its affiliates.
@@ -19,6 +19,19 @@ var ReactInternals = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
19
19
 
20
20
  var _assign = ReactInternals.assign;
21
21
 
22
+ // Do not require this module directly! Use normal `invariant` calls with
23
+ // template literal strings. The messages will be converted to ReactError during
24
+ // build, and in production they will be minified.
25
+
26
+ // Do not require this module directly! Use normal `invariant` calls with
27
+ // template literal strings. The messages will be converted to ReactError during
28
+ // build, and in production they will be minified.
29
+
30
+ function ReactError(error) {
31
+ error.name = 'Invariant Violation';
32
+ return error;
33
+ }
34
+
22
35
  /**
23
36
  * Use invariant() to assert state which your program assumes to be true.
24
37
  *
@@ -30,40 +43,6 @@ var _assign = ReactInternals.assign;
30
43
  * will remain to ensure logic does not differ in production.
31
44
  */
32
45
 
33
- var validateFormat = function () {};
34
-
35
- {
36
- validateFormat = function (format) {
37
- if (format === undefined) {
38
- throw new Error('invariant requires an error message argument');
39
- }
40
- };
41
- }
42
-
43
- function invariant(condition, format, a, b, c, d, e, f) {
44
- validateFormat(format);
45
-
46
- if (!condition) {
47
- var error = void 0;
48
- if (format === undefined) {
49
- error = new Error('Minified exception occurred; use the non-minified dev environment ' + 'for the full error message and additional helpful warnings.');
50
- } else {
51
- var args = [a, b, c, d, e, f];
52
- var argIndex = 0;
53
- error = new Error(format.replace(/%s/g, function () {
54
- return args[argIndex++];
55
- }));
56
- error.name = 'Invariant Violation';
57
- }
58
-
59
- error.framesToPop = 1; // we don't care about invariant's own frame
60
- throw error;
61
- }
62
- }
63
-
64
- // Relying on the `invariant()` implementation lets us
65
- // preserve the format and params in the www builds.
66
-
67
46
  /**
68
47
  * Similar to invariant but only logs a warning if the condition is not met.
69
48
  * This can be used to log issues in development environments in critical
@@ -145,10 +124,24 @@ if (!ReactSharedInternals.hasOwnProperty('ReactCurrentDispatcher')) {
145
124
  current: null
146
125
  };
147
126
  }
127
+ if (!ReactSharedInternals.hasOwnProperty('ReactCurrentBatchConfig')) {
128
+ ReactSharedInternals.ReactCurrentBatchConfig = {
129
+ suspense: null
130
+ };
131
+ }
148
132
 
149
133
  // The Symbol used to tag the ReactElement-like types. If there is no native Symbol
150
134
  // nor polyfill, then a plain number is used for performance.
151
135
 
136
+
137
+
138
+
139
+
140
+
141
+
142
+ // TODO: We don't use AsyncMode or ConcurrentMode anymore. They were temporary
143
+ // (unstable) APIs that have been removed. Can we remove the symbols?
144
+
152
145
  var FunctionComponent = 0;
153
146
  var ClassComponent = 1;
154
147
  // Before we know whether it is function or class
@@ -218,7 +211,13 @@ function isFiberMountedImpl(fiber) {
218
211
 
219
212
 
220
213
  function assertIsMounted(fiber) {
221
- !(isFiberMountedImpl(fiber) === MOUNTED) ? invariant(false, 'Unable to find node on an unmounted component.') : void 0;
214
+ (function () {
215
+ if (!(isFiberMountedImpl(fiber) === MOUNTED)) {
216
+ {
217
+ throw ReactError(Error('Unable to find node on an unmounted component.'));
218
+ }
219
+ }
220
+ })();
222
221
  }
223
222
 
224
223
  function findCurrentFiberUsingSlowPath(fiber) {
@@ -226,7 +225,13 @@ function findCurrentFiberUsingSlowPath(fiber) {
226
225
  if (!alternate) {
227
226
  // If there is no alternate, then we only need to check if it is mounted.
228
227
  var state = isFiberMountedImpl(fiber);
229
- !(state !== UNMOUNTED) ? invariant(false, 'Unable to find node on an unmounted component.') : void 0;
228
+ (function () {
229
+ if (!(state !== UNMOUNTED)) {
230
+ {
231
+ throw ReactError(Error('Unable to find node on an unmounted component.'));
232
+ }
233
+ }
234
+ })();
230
235
  if (state === MOUNTING) {
231
236
  return null;
232
237
  }
@@ -239,11 +244,24 @@ function findCurrentFiberUsingSlowPath(fiber) {
239
244
  var b = alternate;
240
245
  while (true) {
241
246
  var parentA = a.return;
242
- var parentB = parentA ? parentA.alternate : null;
243
- if (!parentA || !parentB) {
247
+ if (parentA === null) {
244
248
  // We're at the root.
245
249
  break;
246
250
  }
251
+ var parentB = parentA.alternate;
252
+ if (parentB === null) {
253
+ // There is no alternate. This is an unusual case. Currently, it only
254
+ // happens when a Suspense component is hidden. An extra fragment fiber
255
+ // is inserted in between the Suspense fiber and its children. Skip
256
+ // over this extra fragment fiber and proceed to the next parent.
257
+ var nextParent = parentA.return;
258
+ if (nextParent !== null) {
259
+ a = b = nextParent;
260
+ continue;
261
+ }
262
+ // If there's no parent, we're at the root.
263
+ break;
264
+ }
247
265
 
248
266
  // If both copies of the parent fiber point to the same child, we can
249
267
  // assume that the child is current. This happens when we bailout on low
@@ -265,7 +283,13 @@ function findCurrentFiberUsingSlowPath(fiber) {
265
283
  }
266
284
  // We should never have an alternate for any mounting node. So the only
267
285
  // way this could possibly happen is if this was unmounted, if at all.
268
- invariant(false, 'Unable to find node on an unmounted component.');
286
+ (function () {
287
+ {
288
+ {
289
+ throw ReactError(Error('Unable to find node on an unmounted component.'));
290
+ }
291
+ }
292
+ })();
269
293
  }
270
294
 
271
295
  if (a.return !== b.return) {
@@ -316,15 +340,33 @@ function findCurrentFiberUsingSlowPath(fiber) {
316
340
  }
317
341
  _child = _child.sibling;
318
342
  }
319
- !didFindChild ? invariant(false, 'Child was not found in either parent set. This indicates a bug in React related to the return pointer. Please file an issue.') : void 0;
343
+ (function () {
344
+ if (!didFindChild) {
345
+ {
346
+ throw ReactError(Error('Child was not found in either parent set. This indicates a bug in React related to the return pointer. Please file an issue.'));
347
+ }
348
+ }
349
+ })();
320
350
  }
321
351
  }
322
352
 
323
- !(a.alternate === b) ? invariant(false, 'Return fibers should always be each others\' alternates. This error is likely caused by a bug in React. Please file an issue.') : void 0;
353
+ (function () {
354
+ if (!(a.alternate === b)) {
355
+ {
356
+ throw ReactError(Error('Return fibers should always be each others\' alternates. This error is likely caused by a bug in React. Please file an issue.'));
357
+ }
358
+ }
359
+ })();
324
360
  }
325
361
  // If the root is not a host container, we're in a disconnected tree. I.e.
326
362
  // unmounted.
327
- !(a.tag === HostRoot) ? invariant(false, 'Unable to find node on an unmounted component.') : void 0;
363
+ (function () {
364
+ if (!(a.tag === HostRoot)) {
365
+ {
366
+ throw ReactError(Error('Unable to find node on an unmounted component.'));
367
+ }
368
+ }
369
+ })();
328
370
  if (a.stateNode.current === a) {
329
371
  // We've determined that A is the current branch.
330
372
  return fiber;
@@ -581,7 +623,13 @@ function getPooledEvent(dispatchConfig, targetInst, nativeEvent, nativeInst) {
581
623
 
582
624
  function releasePooledEvent(event) {
583
625
  var EventConstructor = this;
584
- !(event instanceof EventConstructor) ? invariant(false, 'Trying to release an event instance into a pool of a different type.') : void 0;
626
+ (function () {
627
+ if (!(event instanceof EventConstructor)) {
628
+ {
629
+ throw ReactError(Error('Trying to release an event instance into a pool of a different type.'));
630
+ }
631
+ }
632
+ })();
585
633
  event.destructor();
586
634
  if (EventConstructor.eventPool.length < EVENT_POOL_SIZE) {
587
635
  EventConstructor.eventPool.push(event);
@@ -653,7 +701,7 @@ var lowPriorityWarning$1 = lowPriorityWarning;
653
701
 
654
702
  var ELEMENT_NODE = 1;
655
703
 
656
- // Do not uses the below two methods directly!
704
+ // Do not use the below two methods directly!
657
705
  // Instead use constants exported from DOMTopLevelEventTypes in ReactDOM.
658
706
  // (It is the only module that is allowed to access these methods.)
659
707
 
@@ -661,7 +709,7 @@ function unsafeCastStringToDOMTopLevelType(topLevelType) {
661
709
  return topLevelType;
662
710
  }
663
711
 
664
- var canUseDOM = !!(typeof window !== 'undefined' && window.document && window.document.createElement);
712
+ var canUseDOM = !!(typeof window !== 'undefined' && typeof window.document !== 'undefined' && typeof window.document.createElement !== 'undefined');
665
713
 
666
714
  /**
667
715
  * Generate a mapping of standard vendor prefixes using the defined style property and event name.
@@ -840,10 +888,221 @@ var TOP_WHEEL = unsafeCastStringToDOMTopLevelType('wheel');
840
888
  // Note that events in this list will *not* be listened to at the top level
841
889
  // unless they're explicitly whitelisted in `ReactBrowserEventEmitter.listenTo`.
842
890
 
843
- // for .act's return value
891
+ var PLUGIN_EVENT_SYSTEM = 1;
892
+
893
+ var didWarnAboutMessageChannel = false;
894
+ var enqueueTask = void 0;
895
+ try {
896
+ // read require off the module object to get around the bundlers.
897
+ // we don't want them to detect a require and bundle a Node polyfill.
898
+ var requireString = ('require' + Math.random()).slice(0, 7);
899
+ var nodeRequire = module && module[requireString];
900
+ // assuming we're in node, let's try to get node's
901
+ // version of setImmediate, bypassing fake timers if any.
902
+ enqueueTask = nodeRequire('timers').setImmediate;
903
+ } catch (_err) {
904
+ // we're in a browser
905
+ // we can't use regular timers because they may still be faked
906
+ // so we try MessageChannel+postMessage instead
907
+ enqueueTask = function (callback) {
908
+ {
909
+ if (didWarnAboutMessageChannel === false) {
910
+ didWarnAboutMessageChannel = true;
911
+ !(typeof MessageChannel !== 'undefined') ? warningWithoutStack$1(false, 'This browser does not have a MessageChannel implementation, ' + 'so enqueuing tasks via await act(async () => ...) will fail. ' + 'Please file an issue at https://github.com/facebook/react/issues ' + 'if you encounter this warning.') : void 0;
912
+ }
913
+ }
914
+ var channel = new MessageChannel();
915
+ channel.port1.onmessage = callback;
916
+ channel.port2.postMessage(undefined);
917
+ };
918
+ }
919
+
920
+ var enqueueTask$1 = enqueueTask;
921
+
922
+ var ReactInternals$1 = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
923
+
924
+ var _ReactInternals$Sched = ReactInternals$1.Scheduler;
925
+ var unstable_cancelCallback = _ReactInternals$Sched.unstable_cancelCallback;
926
+ var unstable_now = _ReactInternals$Sched.unstable_now;
927
+ var unstable_scheduleCallback = _ReactInternals$Sched.unstable_scheduleCallback;
928
+ var unstable_shouldYield = _ReactInternals$Sched.unstable_shouldYield;
929
+ var unstable_requestPaint = _ReactInternals$Sched.unstable_requestPaint;
930
+ var unstable_getFirstCallbackNode = _ReactInternals$Sched.unstable_getFirstCallbackNode;
931
+ var unstable_runWithPriority = _ReactInternals$Sched.unstable_runWithPriority;
932
+ var unstable_next = _ReactInternals$Sched.unstable_next;
933
+ var unstable_continueExecution = _ReactInternals$Sched.unstable_continueExecution;
934
+ var unstable_pauseExecution = _ReactInternals$Sched.unstable_pauseExecution;
935
+ var unstable_getCurrentPriorityLevel = _ReactInternals$Sched.unstable_getCurrentPriorityLevel;
936
+ var unstable_ImmediatePriority = _ReactInternals$Sched.unstable_ImmediatePriority;
937
+ var unstable_UserBlockingPriority = _ReactInternals$Sched.unstable_UserBlockingPriority;
938
+ var unstable_NormalPriority = _ReactInternals$Sched.unstable_NormalPriority;
939
+ var unstable_LowPriority = _ReactInternals$Sched.unstable_LowPriority;
940
+ var unstable_IdlePriority = _ReactInternals$Sched.unstable_IdlePriority;
941
+ var unstable_forceFrameRate = _ReactInternals$Sched.unstable_forceFrameRate;
942
+ var unstable_flushAllWithoutAsserting = _ReactInternals$Sched.unstable_flushAllWithoutAsserting;
943
+
944
+ // Keep in sync with ReactDOMUnstableNativeDependencies.js
945
+ // ReactDOM.js, and ReactTestUtils.js:
946
+ var _ReactDOM$__SECRET_IN$1 = ReactDOM.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.Events;
947
+ var getInstanceFromNode$1 = _ReactDOM$__SECRET_IN$1[0];
948
+ var getNodeFromInstance$1 = _ReactDOM$__SECRET_IN$1[1];
949
+ var getFiberCurrentPropsFromNode$1 = _ReactDOM$__SECRET_IN$1[2];
950
+ var injectEventPluginsByName$1 = _ReactDOM$__SECRET_IN$1[3];
951
+ var eventNameDispatchConfigs$1 = _ReactDOM$__SECRET_IN$1[4];
952
+ var accumulateTwoPhaseDispatches$1 = _ReactDOM$__SECRET_IN$1[5];
953
+ var accumulateDirectDispatches$1 = _ReactDOM$__SECRET_IN$1[6];
954
+ var enqueueStateRestore$1 = _ReactDOM$__SECRET_IN$1[7];
955
+ var restoreStateIfNeeded$1 = _ReactDOM$__SECRET_IN$1[8];
956
+ var dispatchEvent$1 = _ReactDOM$__SECRET_IN$1[9];
957
+ var runEventsInBatch$1 = _ReactDOM$__SECRET_IN$1[10];
958
+ var flushPassiveEffects$1 = _ReactDOM$__SECRET_IN$1[11];
959
+ var IsThisRendererActing$1 = _ReactDOM$__SECRET_IN$1[12];
960
+
961
+
962
+ var batchedUpdates = ReactDOM.unstable_batchedUpdates;
963
+
964
+ var IsSomeRendererActing = ReactSharedInternals.IsSomeRendererActing;
965
+
966
+ // this implementation should be exactly the same in
967
+ // ReactTestUtilsAct.js, ReactTestRendererAct.js, createReactNoop.js
968
+
969
+ var isSchedulerMocked = typeof unstable_flushAllWithoutAsserting === 'function';
970
+ var flushWork = unstable_flushAllWithoutAsserting || function () {
971
+ var didFlushWork = false;
972
+ while (flushPassiveEffects$1()) {
973
+ didFlushWork = true;
974
+ }
975
+
976
+ return didFlushWork;
977
+ };
978
+
979
+ function flushWorkAndMicroTasks(onDone) {
980
+ try {
981
+ flushWork();
982
+ enqueueTask$1(function () {
983
+ if (flushWork()) {
984
+ flushWorkAndMicroTasks(onDone);
985
+ } else {
986
+ onDone();
987
+ }
988
+ });
989
+ } catch (err) {
990
+ onDone(err);
991
+ }
992
+ }
993
+
994
+ // we track the 'depth' of the act() calls with this counter,
995
+ // so we can tell if any async act() calls try to run in parallel.
996
+
997
+ var actingUpdatesScopeDepth = 0;
998
+ function act(callback) {
999
+ var previousActingUpdatesScopeDepth = actingUpdatesScopeDepth;
1000
+ var previousIsSomeRendererActing = void 0;
1001
+ var previousIsThisRendererActing = void 0;
1002
+ actingUpdatesScopeDepth++;
1003
+
1004
+ previousIsSomeRendererActing = IsSomeRendererActing.current;
1005
+ previousIsThisRendererActing = IsThisRendererActing$1.current;
1006
+ IsSomeRendererActing.current = true;
1007
+ IsThisRendererActing$1.current = true;
1008
+
1009
+ function onDone() {
1010
+ actingUpdatesScopeDepth--;
1011
+ IsSomeRendererActing.current = previousIsSomeRendererActing;
1012
+ IsThisRendererActing$1.current = previousIsThisRendererActing;
1013
+ {
1014
+ if (actingUpdatesScopeDepth > previousActingUpdatesScopeDepth) {
1015
+ // if it's _less than_ previousActingUpdatesScopeDepth, then we can assume the 'other' one has warned
1016
+ warningWithoutStack$1(false, 'You seem to have overlapping act() calls, this is not supported. ' + 'Be sure to await previous act() calls before making a new one. ');
1017
+ }
1018
+ }
1019
+ }
1020
+
1021
+ var result = void 0;
1022
+ try {
1023
+ result = batchedUpdates(callback);
1024
+ } catch (error) {
1025
+ // on sync errors, we still want to 'cleanup' and decrement actingUpdatesScopeDepth
1026
+ onDone();
1027
+ throw error;
1028
+ }
1029
+
1030
+ if (result !== null && typeof result === 'object' && typeof result.then === 'function') {
1031
+ // setup a boolean that gets set to true only
1032
+ // once this act() call is await-ed
1033
+ var called = false;
1034
+ {
1035
+ if (typeof Promise !== 'undefined') {
1036
+ //eslint-disable-next-line no-undef
1037
+ Promise.resolve().then(function () {}).then(function () {
1038
+ if (called === false) {
1039
+ warningWithoutStack$1(false, 'You called act(async () => ...) without await. ' + 'This could lead to unexpected testing behaviour, interleaving multiple act ' + 'calls and mixing their scopes. You should - await act(async () => ...);');
1040
+ }
1041
+ });
1042
+ }
1043
+ }
1044
+
1045
+ // in the async case, the returned thenable runs the callback, flushes
1046
+ // effects and microtasks in a loop until flushPassiveEffects() === false,
1047
+ // and cleans up
1048
+ return {
1049
+ then: function (resolve, reject) {
1050
+ called = true;
1051
+ result.then(function () {
1052
+ if (actingUpdatesScopeDepth > 1 || isSchedulerMocked === true && previousIsSomeRendererActing === true) {
1053
+ onDone();
1054
+ resolve();
1055
+ return;
1056
+ }
1057
+ // we're about to exit the act() scope,
1058
+ // now's the time to flush tasks/effects
1059
+ flushWorkAndMicroTasks(function (err) {
1060
+ onDone();
1061
+ if (err) {
1062
+ reject(err);
1063
+ } else {
1064
+ resolve();
1065
+ }
1066
+ });
1067
+ }, function (err) {
1068
+ onDone();
1069
+ reject(err);
1070
+ });
1071
+ }
1072
+ };
1073
+ } else {
1074
+ {
1075
+ !(result === undefined) ? warningWithoutStack$1(false, 'The callback passed to act(...) function ' + 'must return undefined, or a Promise. You returned %s', result) : void 0;
1076
+ }
1077
+
1078
+ // flush effects until none remain, and cleanup
1079
+ try {
1080
+ if (actingUpdatesScopeDepth === 1 && (isSchedulerMocked === false || previousIsSomeRendererActing === false)) {
1081
+ // we're about to exit the act() scope,
1082
+ // now's the time to flush effects
1083
+ flushWork();
1084
+ }
1085
+ onDone();
1086
+ } catch (err) {
1087
+ onDone();
1088
+ throw err;
1089
+ }
1090
+
1091
+ // in the sync case, the returned thenable only warns *if* await-ed
1092
+ return {
1093
+ then: function (resolve) {
1094
+ {
1095
+ warningWithoutStack$1(false, 'Do not await the result of calling act(...) with sync logic, it is not a Promise.');
1096
+ }
1097
+ resolve();
1098
+ }
1099
+ };
1100
+ }
1101
+ }
1102
+
844
1103
  var findDOMNode = ReactDOM.findDOMNode;
845
1104
  // Keep in sync with ReactDOMUnstableNativeDependencies.js
846
- // and ReactDOM.js:
1105
+ // ReactDOM.js, and ReactTestUtilsAct.js:
847
1106
 
848
1107
  var _ReactDOM$__SECRET_IN = ReactDOM.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.Events;
849
1108
  var getInstanceFromNode = _ReactDOM$__SECRET_IN[0];
@@ -857,6 +1116,8 @@ var enqueueStateRestore = _ReactDOM$__SECRET_IN[7];
857
1116
  var restoreStateIfNeeded = _ReactDOM$__SECRET_IN[8];
858
1117
  var dispatchEvent = _ReactDOM$__SECRET_IN[9];
859
1118
  var runEventsInBatch = _ReactDOM$__SECRET_IN[10];
1119
+ var flushPassiveEffects = _ReactDOM$__SECRET_IN[11];
1120
+ var IsThisRendererActing = _ReactDOM$__SECRET_IN[12];
860
1121
 
861
1122
 
862
1123
  function Event(suffix) {}
@@ -876,7 +1137,7 @@ var hasWarnedAboutDeprecatedMockComponent = false;
876
1137
  */
877
1138
  function simulateNativeEventOnNode(topLevelType, node, fakeNativeEvent) {
878
1139
  fakeNativeEvent.target = node;
879
- dispatchEvent(topLevelType, fakeNativeEvent);
1140
+ dispatchEvent(topLevelType, PLUGIN_EVENT_SYSTEM, fakeNativeEvent);
880
1141
  }
881
1142
 
882
1143
  /**
@@ -946,12 +1207,21 @@ function validateClassInstance(inst, methodName) {
946
1207
  } else {
947
1208
  received = stringified;
948
1209
  }
949
- invariant(false, '%s(...): the first argument must be a React class instance. Instead received: %s.', methodName, received);
1210
+ (function () {
1211
+ {
1212
+ {
1213
+ throw ReactError(Error(methodName + '(...): the first argument must be a React class instance. Instead received: ' + received + '.'));
1214
+ }
1215
+ }
1216
+ })();
950
1217
  }
951
1218
 
952
- // a stub element, lazily initialized, used by act() when flushing effects
1219
+ // a plain dom element, lazily initialized, used by act() when flushing effects
953
1220
  var actContainerElement = null;
954
1221
 
1222
+ // a warning for when you try to use TestUtils.act in a non-browser environment
1223
+ var didWarnAboutActInNodejs = false;
1224
+
955
1225
  /**
956
1226
  * Utilities for making it easy to test React components.
957
1227
  *
@@ -1032,7 +1302,13 @@ var ReactTestUtils = {
1032
1302
  var classList = className.split(/\s+/);
1033
1303
 
1034
1304
  if (!Array.isArray(classNames)) {
1035
- !(classNames !== undefined) ? invariant(false, 'TestUtils.scryRenderedDOMComponentsWithClass expects a className as a second argument.') : void 0;
1305
+ (function () {
1306
+ if (!(classNames !== undefined)) {
1307
+ {
1308
+ throw ReactError(Error('TestUtils.scryRenderedDOMComponentsWithClass expects a className as a second argument.'));
1309
+ }
1310
+ }
1311
+ })();
1036
1312
  classNames = classNames.split(/\s+/);
1037
1313
  }
1038
1314
  return classNames.every(function (name) {
@@ -1150,38 +1426,17 @@ var ReactTestUtils = {
1150
1426
 
1151
1427
  act: function (callback) {
1152
1428
  if (actContainerElement === null) {
1153
- // warn if we can't actually create the stub element
1154
1429
  {
1155
- !(typeof document !== 'undefined' && document !== null && typeof document.createElement === 'function') ? warningWithoutStack$1(false, 'It looks like you called TestUtils.act(...) in a non-browser environment. ' + "If you're using TestRenderer for your tests, you should call " + 'TestRenderer.act(...) instead of TestUtils.act(...).') : void 0;
1156
- }
1157
- // then make it
1158
- actContainerElement = document.createElement('div');
1159
- }
1160
-
1161
- var result = ReactDOM.unstable_batchedUpdates(callback);
1162
- // note: keep these warning messages in sync with
1163
- // createReactNoop.js and ReactTestRenderer.js
1164
- {
1165
- if (result !== undefined) {
1166
- var addendum = void 0;
1167
- if (result !== null && typeof result.then === 'function') {
1168
- addendum = '\n\nIt looks like you wrote ReactTestUtils.act(async () => ...), ' + 'or returned a Promise from the callback passed to it. ' + 'Putting asynchronous logic inside ReactTestUtils.act(...) is not supported.\n';
1169
- } else {
1170
- addendum = ' You returned: ' + result;
1430
+ // warn if we're trying to use this in something like node (without jsdom)
1431
+ if (didWarnAboutActInNodejs === false) {
1432
+ didWarnAboutActInNodejs = true;
1433
+ !(typeof document !== 'undefined' && document !== null) ? warningWithoutStack$1(false, 'It looks like you called ReactTestUtils.act(...) in a non-browser environment. ' + "If you're using TestRenderer for your tests, you should call " + 'ReactTestRenderer.act(...) instead of ReactTestUtils.act(...).') : void 0;
1171
1434
  }
1172
- warningWithoutStack$1(false, 'The callback passed to ReactTestUtils.act(...) function must not return anything.%s', addendum);
1173
1435
  }
1436
+ // now make the stub element
1437
+ actContainerElement = document.createElement('div');
1174
1438
  }
1175
- ReactDOM.render(React.createElement('div', null), actContainerElement);
1176
- // we want the user to not expect a return,
1177
- // but we want to warn if they use it like they can await on it.
1178
- return {
1179
- then: function () {
1180
- {
1181
- warningWithoutStack$1(false, 'Do not await the result of calling ReactTestUtils.act(...), it is not a Promise.');
1182
- }
1183
- }
1184
- };
1439
+ return act(callback);
1185
1440
  }
1186
1441
  };
1187
1442
 
@@ -1195,8 +1450,20 @@ var ReactTestUtils = {
1195
1450
  */
1196
1451
  function makeSimulator(eventType) {
1197
1452
  return function (domNode, eventData) {
1198
- !!React.isValidElement(domNode) ? invariant(false, 'TestUtils.Simulate expected a DOM node as the first argument but received a React element. Pass the DOM node you wish to simulate the event on instead. Note that TestUtils.Simulate will not work if you are using shallow rendering.') : void 0;
1199
- !!ReactTestUtils.isCompositeComponent(domNode) ? invariant(false, 'TestUtils.Simulate expected a DOM node as the first argument but received a component instance. Pass the DOM node you wish to simulate the event on instead.') : void 0;
1453
+ (function () {
1454
+ if (!!React.isValidElement(domNode)) {
1455
+ {
1456
+ throw ReactError(Error('TestUtils.Simulate expected a DOM node as the first argument but received a React element. Pass the DOM node you wish to simulate the event on instead. Note that TestUtils.Simulate will not work if you are using shallow rendering.'));
1457
+ }
1458
+ }
1459
+ })();
1460
+ (function () {
1461
+ if (!!ReactTestUtils.isCompositeComponent(domNode)) {
1462
+ {
1463
+ throw ReactError(Error('TestUtils.Simulate expected a DOM node as the first argument but received a component instance. Pass the DOM node you wish to simulate the event on instead.'));
1464
+ }
1465
+ }
1466
+ })();
1200
1467
 
1201
1468
  var dispatchConfig = eventNameDispatchConfigs[eventType];
1202
1469