react-dom 16.12.0 → 16.13.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 (42) hide show
  1. package/build-info.json +4 -4
  2. package/cjs/react-dom-server.browser.development.js +331 -594
  3. package/cjs/react-dom-server.browser.production.min.js +37 -37
  4. package/cjs/react-dom-server.node.development.js +330 -593
  5. package/cjs/react-dom-server.node.production.min.js +38 -38
  6. package/cjs/react-dom-test-utils.development.js +171 -328
  7. package/cjs/react-dom-test-utils.production.min.js +17 -17
  8. package/cjs/react-dom-unstable-fizz.browser.development.js +3 -21
  9. package/cjs/react-dom-unstable-fizz.browser.production.min.js +2 -2
  10. package/cjs/react-dom-unstable-fizz.node.development.js +2 -18
  11. package/cjs/react-dom-unstable-fizz.node.production.min.js +3 -3
  12. package/cjs/react-dom-unstable-native-dependencies.development.js +190 -305
  13. package/cjs/react-dom-unstable-native-dependencies.production.min.js +23 -27
  14. package/cjs/react-dom.development.js +11227 -13976
  15. package/cjs/react-dom.production.min.js +280 -278
  16. package/cjs/react-dom.profiling.min.js +287 -284
  17. package/package.json +3 -8
  18. package/umd/react-dom-server.browser.development.js +3320 -3594
  19. package/umd/react-dom-server.browser.production.min.js +35 -35
  20. package/umd/react-dom-test-utils.development.js +1200 -1357
  21. package/umd/react-dom-test-utils.production.min.js +23 -23
  22. package/umd/react-dom-unstable-fizz.browser.development.js +105 -123
  23. package/umd/react-dom-unstable-fizz.browser.production.min.js +3 -3
  24. package/umd/react-dom-unstable-native-dependencies.development.js +1333 -1449
  25. package/umd/react-dom-unstable-native-dependencies.production.min.js +21 -22
  26. package/umd/react-dom.development.js +19953 -22713
  27. package/umd/react-dom.production.min.js +229 -232
  28. package/umd/react-dom.profiling.min.js +236 -239
  29. package/cjs/react-dom-unstable-flight-client.development.js +0 -357
  30. package/cjs/react-dom-unstable-flight-client.production.min.js +0 -16
  31. package/cjs/react-dom-unstable-flight-server.browser.development.js +0 -392
  32. package/cjs/react-dom-unstable-flight-server.browser.production.min.js +0 -16
  33. package/cjs/react-dom-unstable-flight-server.node.development.js +0 -415
  34. package/cjs/react-dom-unstable-flight-server.node.production.min.js +0 -16
  35. package/umd/react-dom-unstable-flight-client.development.js +0 -357
  36. package/umd/react-dom-unstable-flight-client.production.min.js +0 -14
  37. package/umd/react-dom-unstable-flight-server.browser.development.js +0 -390
  38. package/umd/react-dom-unstable-flight-server.browser.production.min.js +0 -14
  39. package/unstable-flight-client.js +0 -7
  40. package/unstable-flight-server.browser.js +0 -7
  41. package/unstable-flight-server.js +0 -3
  42. package/unstable-flight-server.node.js +0 -7
@@ -1,4 +1,4 @@
1
- /** @license React v16.12.0
1
+ /** @license React v16.13.0
2
2
  * react-dom-test-utils.development.js
3
3
  *
4
4
  * Copyright (c) Facebook, Inc. and its affiliates.
@@ -20,58 +20,72 @@ var React = require('react');
20
20
  var ReactDOM = require('react-dom');
21
21
  var Scheduler = require('scheduler');
22
22
 
23
- // Do not require this module directly! Use normal `invariant` calls with
24
- // template literal strings. The messages will be replaced with error codes
25
- // during build.
23
+ var ReactSharedInternals = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED; // Prevent newer renderers from RTE when used with older react package versions.
24
+ // Current owner and dispatcher used to share the same ref,
25
+ // but PR #14548 split them out to better support the react-debug-tools package.
26
26
 
27
- /**
28
- * Use invariant() to assert state which your program assumes to be true.
29
- *
30
- * Provide sprintf-style format (only %s is supported) and arguments
31
- * to provide information about what broke and what you were
32
- * expecting.
33
- *
34
- * The invariant message will be stripped in production, but the invariant
35
- * will remain to ensure logic does not differ in production.
36
- */
27
+ if (!ReactSharedInternals.hasOwnProperty('ReactCurrentDispatcher')) {
28
+ ReactSharedInternals.ReactCurrentDispatcher = {
29
+ current: null
30
+ };
31
+ }
37
32
 
38
- /**
39
- * Similar to invariant but only logs a warning if the condition is not met.
40
- * This can be used to log issues in development environments in critical
41
- * paths. Removing the logging code for production environments will keep the
42
- * same logic and follow the same code paths.
43
- */
44
- var warningWithoutStack = function () {};
33
+ if (!ReactSharedInternals.hasOwnProperty('ReactCurrentBatchConfig')) {
34
+ ReactSharedInternals.ReactCurrentBatchConfig = {
35
+ suspense: null
36
+ };
37
+ }
45
38
 
46
- {
47
- warningWithoutStack = function (condition, format) {
48
- for (var _len = arguments.length, args = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
49
- args[_key - 2] = arguments[_key];
50
- }
39
+ // by calls to these methods by a Babel plugin.
40
+ //
41
+ // In PROD (or in packages without access to React internals),
42
+ // they are left as they are instead.
51
43
 
52
- if (format === undefined) {
53
- throw new Error('`warningWithoutStack(condition, format, ...args)` requires a warning ' + 'message argument');
44
+ function warn(format) {
45
+ {
46
+ for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
47
+ args[_key - 1] = arguments[_key];
54
48
  }
55
49
 
56
- if (args.length > 8) {
57
- // Check before the condition to catch violations early.
58
- throw new Error('warningWithoutStack() currently supports at most 8 arguments.');
50
+ printWarning('warn', format, args);
51
+ }
52
+ }
53
+ function error(format) {
54
+ {
55
+ for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
56
+ args[_key2 - 1] = arguments[_key2];
59
57
  }
60
58
 
61
- if (condition) {
62
- return;
63
- }
59
+ printWarning('error', format, args);
60
+ }
61
+ }
64
62
 
65
- if (typeof console !== 'undefined') {
66
- var argsWithFormat = args.map(function (item) {
67
- return '' + item;
68
- });
69
- argsWithFormat.unshift('Warning: ' + format); // We intentionally don't use spread (or .apply) directly because it
70
- // breaks IE9: https://github.com/facebook/react/issues/13610
63
+ function printWarning(level, format, args) {
64
+ // When changing this logic, you might want to also
65
+ // update consoleWithStackDev.www.js as well.
66
+ {
67
+ var hasExistingStack = args.length > 0 && typeof args[args.length - 1] === 'string' && args[args.length - 1].indexOf('\n in') === 0;
71
68
 
72
- Function.prototype.apply.call(console.error, console, argsWithFormat);
69
+ if (!hasExistingStack) {
70
+ var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;
71
+ var stack = ReactDebugCurrentFrame.getStackAddendum();
72
+
73
+ if (stack !== '') {
74
+ format += '%s';
75
+ args = args.concat([stack]);
76
+ }
73
77
  }
74
78
 
79
+ var argsWithFormat = args.map(function (item) {
80
+ return '' + item;
81
+ }); // Careful: RN currently depends on this prefix
82
+
83
+ argsWithFormat.unshift('Warning: ' + format); // We intentionally don't use spread (or .apply) directly because it
84
+ // breaks IE9: https://github.com/facebook/react/issues/13610
85
+ // eslint-disable-next-line react-internal/no-production-logging
86
+
87
+ Function.prototype.apply.call(console[level], console, argsWithFormat);
88
+
75
89
  try {
76
90
  // --- Welcome to debugging React ---
77
91
  // This error was thrown as a convenience so that you can use this stack
@@ -82,11 +96,9 @@ var warningWithoutStack = function () {};
82
96
  });
83
97
  throw new Error(message);
84
98
  } catch (x) {}
85
- };
99
+ }
86
100
  }
87
101
 
88
- var warningWithoutStack$1 = warningWithoutStack;
89
-
90
102
  /**
91
103
  * `ReactInstanceMap` maintains a mapping from a public facing stateful
92
104
  * instance (key) and the internal representation (value). This allows public
@@ -96,56 +108,15 @@ var warningWithoutStack$1 = warningWithoutStack;
96
108
  * Note that this module is currently shared and assumed to be stateless.
97
109
  * If this becomes an actual Map, that will break.
98
110
  */
99
-
100
- /**
101
- * This API should be called `delete` but we'd have to make sure to always
102
- * transform these to strings for IE support. When this transform is fully
103
- * supported we can rename it.
104
- */
105
-
106
111
  function get(key) {
107
112
  return key._reactInternalFiber;
108
113
  }
109
114
 
110
- var ReactSharedInternals = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED; // Prevent newer renderers from RTE when used with older react package versions.
111
- // Current owner and dispatcher used to share the same ref,
112
- // but PR #14548 split them out to better support the react-debug-tools package.
113
-
114
- if (!ReactSharedInternals.hasOwnProperty('ReactCurrentDispatcher')) {
115
- ReactSharedInternals.ReactCurrentDispatcher = {
116
- current: null
117
- };
118
- }
119
-
120
- if (!ReactSharedInternals.hasOwnProperty('ReactCurrentBatchConfig')) {
121
- ReactSharedInternals.ReactCurrentBatchConfig = {
122
- suspense: null
123
- };
124
- }
125
-
126
- // The Symbol used to tag the ReactElement-like types. If there is no native Symbol
127
- // nor polyfill, then a plain number is used for performance.
128
-
129
-
130
-
131
-
132
-
133
-
134
- // TODO: We don't use AsyncMode or ConcurrentMode anymore. They were temporary
135
- // (unstable) APIs that have been removed. Can we remove the symbols?
136
-
137
- {
138
-
139
- }
140
-
141
115
  var FunctionComponent = 0;
142
116
  var ClassComponent = 1;
143
- // Before we know whether it is function or class
144
117
 
145
118
  var HostRoot = 3; // Root of a host tree. Could be nested inside another node.
146
119
 
147
- // A subtree. Could be an entry point to a different renderer.
148
-
149
120
  var HostComponent = 5;
150
121
  var HostText = 6;
151
122
 
@@ -153,84 +124,13 @@ var HostText = 6;
153
124
  var NoEffect =
154
125
  /* */
155
126
  0;
156
- // You can change the rest (and add more).
157
127
 
158
128
  var Placement =
159
129
  /* */
160
130
  2;
161
-
162
-
163
-
164
-
165
-
166
-
167
-
168
-
169
-
170
131
  var Hydrating =
171
132
  /* */
172
133
  1024;
173
- // Passive & Update & Callback & Ref & Snapshot
174
-
175
- // Union of all host effects
176
-
177
- // Helps identify side effects in render-phase lifecycle hooks and setState
178
- // reducers by double invoking them in Strict Mode.
179
-
180
- // To preserve the "Pause on caught exceptions" behavior of the debugger, we
181
- // replay the begin phase of a failed component inside invokeGuardedCallback.
182
-
183
- // Warn about deprecated, async-unsafe lifecycles; relates to RFC #6:
184
-
185
- // Gather advanced timing metrics for Profiler subtrees.
186
-
187
- // Trace which interactions trigger each commit.
188
-
189
- // SSR experiments
190
-
191
-
192
- // Only used in www builds.
193
-
194
- // Only used in www builds.
195
-
196
- // Disable javascript: URL strings in href for XSS protection.
197
-
198
- // React Fire: prevent the value and checked attributes from syncing
199
- // with their related DOM properties
200
-
201
- // These APIs will no longer be "unstable" in the upcoming 16.7 release,
202
- // Control this behavior with a flag to support 16.6 minor releases in the meanwhile.
203
-
204
-
205
- // Experimental React Flare event system and event components support.
206
-
207
- // Experimental Host Component support.
208
-
209
- // Experimental Scope support.
210
-
211
- // New API for JSX transforms to target - https://github.com/reactjs/rfcs/pull/107
212
-
213
- // We will enforce mocking scheduler with scheduler/unstable_mock at some point. (v17?)
214
- // Till then, we warn about the missing mock, but still fallback to a legacy mode compatible version
215
-
216
- // For tests, we flush suspense fallbacks in an act scope;
217
- // *except* in some of our own tests, where we test incremental loading states.
218
-
219
- // Add a callback property to suspense to notify which promises are currently
220
- // in the update queue. This allows reporting and tracing of what is causing
221
- // the user to see a loading state.
222
- // Also allows hydration callbacks to fire when a dehydrated boundary gets
223
- // hydrated or deleted.
224
-
225
- // Part of the simplification of React.createElement so we can eventually move
226
- // from React.createElement to React.jsx
227
- // https://github.com/reactjs/rfcs/blob/createlement-rfc/text/0000-create-element-changes.md
228
-
229
-
230
-
231
-
232
-
233
- // Flag to turn event.target and event.currentTarget in ReactNative from a reactTag to a component instance
234
134
 
235
135
  var ReactCurrentOwner = ReactSharedInternals.ReactCurrentOwner;
236
136
  function getNearestMountedFiber(fiber) {
@@ -271,14 +171,10 @@ function getNearestMountedFiber(fiber) {
271
171
  return null;
272
172
  }
273
173
 
274
-
275
-
276
-
277
-
278
174
  function assertIsMounted(fiber) {
279
175
  if (!(getNearestMountedFiber(fiber) === fiber)) {
280
176
  {
281
- throw Error("Unable to find node on an unmounted component.");
177
+ throw Error( "Unable to find node on an unmounted component." );
282
178
  }
283
179
  }
284
180
  }
@@ -292,7 +188,7 @@ function findCurrentFiberUsingSlowPath(fiber) {
292
188
 
293
189
  if (!(nearestMounted !== null)) {
294
190
  {
295
- throw Error("Unable to find node on an unmounted component.");
191
+ throw Error( "Unable to find node on an unmounted component." );
296
192
  }
297
193
  }
298
194
 
@@ -361,7 +257,7 @@ function findCurrentFiberUsingSlowPath(fiber) {
361
257
 
362
258
  {
363
259
  {
364
- throw Error("Unable to find node on an unmounted component.");
260
+ throw Error( "Unable to find node on an unmounted component." );
365
261
  }
366
262
  }
367
263
  }
@@ -424,7 +320,7 @@ function findCurrentFiberUsingSlowPath(fiber) {
424
320
 
425
321
  if (!didFindChild) {
426
322
  {
427
- throw Error("Child was not found in either parent set. This indicates a bug in React related to the return pointer. Please file an issue.");
323
+ throw Error( "Child was not found in either parent set. This indicates a bug in React related to the return pointer. Please file an issue." );
428
324
  }
429
325
  }
430
326
  }
@@ -432,7 +328,7 @@ function findCurrentFiberUsingSlowPath(fiber) {
432
328
 
433
329
  if (!(a.alternate === b)) {
434
330
  {
435
- throw Error("Return fibers should always be each others' alternates. This error is likely caused by a bug in React. Please file an issue.");
331
+ throw Error( "Return fibers should always be each others' alternates. This error is likely caused by a bug in React. Please file an issue." );
436
332
  }
437
333
  }
438
334
  } // If the root is not a host container, we're in a disconnected tree. I.e.
@@ -441,7 +337,7 @@ function findCurrentFiberUsingSlowPath(fiber) {
441
337
 
442
338
  if (!(a.tag === HostRoot)) {
443
339
  {
444
- throw Error("Unable to find node on an unmounted component.");
340
+ throw Error( "Unable to find node on an unmounted component." );
445
341
  }
446
342
  }
447
343
 
@@ -454,7 +350,6 @@ function findCurrentFiberUsingSlowPath(fiber) {
454
350
  return alternate;
455
351
  }
456
352
 
457
- /* eslint valid-typeof: 0 */
458
353
  var EVENT_POOL_SIZE = 10;
459
354
  /**
460
355
  * @interface Event
@@ -696,8 +591,9 @@ function getPooledWarningPropertyDefinition(propName, getVal) {
696
591
  }
697
592
 
698
593
  function warn(action, result) {
699
- var warningCondition = false;
700
- !warningCondition ? warningWithoutStack$1(false, "This synthetic event is reused for performance reasons. If you're seeing this, " + "you're %s `%s` on a released/nullified synthetic event. %s. " + 'If you must keep the original synthetic event around, use event.persist(). ' + 'See https://fb.me/react-event-pooling for more information.', action, propName, result) : void 0;
594
+ {
595
+ error("This synthetic event is reused for performance reasons. If you're seeing this, " + "you're %s `%s` on a released/nullified synthetic event. %s. " + 'If you must keep the original synthetic event around, use event.persist(). ' + 'See https://fb.me/react-event-pooling for more information.', action, propName, result);
596
+ }
701
597
  }
702
598
  }
703
599
 
@@ -718,7 +614,7 @@ function releasePooledEvent(event) {
718
614
 
719
615
  if (!(event instanceof EventConstructor)) {
720
616
  {
721
- throw Error("Trying to release an event instance into a pool of a different type.");
617
+ throw Error( "Trying to release an event instance into a pool of a different type." );
722
618
  }
723
619
  }
724
620
 
@@ -735,61 +631,6 @@ function addEventPoolingTo(EventConstructor) {
735
631
  EventConstructor.release = releasePooledEvent;
736
632
  }
737
633
 
738
- /**
739
- * Forked from fbjs/warning:
740
- * https://github.com/facebook/fbjs/blob/e66ba20ad5be433eb54423f2b097d829324d9de6/packages/fbjs/src/__forks__/warning.js
741
- *
742
- * Only change is we use console.warn instead of console.error,
743
- * and do nothing when 'console' is not supported.
744
- * This really simplifies the code.
745
- * ---
746
- * Similar to invariant but only logs a warning if the condition is not met.
747
- * This can be used to log issues in development environments in critical
748
- * paths. Removing the logging code for production environments will keep the
749
- * same logic and follow the same code paths.
750
- */
751
- var lowPriorityWarningWithoutStack = function () {};
752
-
753
- {
754
- var printWarning = function (format) {
755
- for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
756
- args[_key - 1] = arguments[_key];
757
- }
758
-
759
- var argIndex = 0;
760
- var message = 'Warning: ' + format.replace(/%s/g, function () {
761
- return args[argIndex++];
762
- });
763
-
764
- if (typeof console !== 'undefined') {
765
- console.warn(message);
766
- }
767
-
768
- try {
769
- // --- Welcome to debugging React ---
770
- // This error was thrown as a convenience so that you can use this stack
771
- // to find the callsite that caused this warning to fire.
772
- throw new Error(message);
773
- } catch (x) {}
774
- };
775
-
776
- lowPriorityWarningWithoutStack = function (condition, format) {
777
- if (format === undefined) {
778
- throw new Error('`lowPriorityWarningWithoutStack(condition, format, ...args)` requires a warning ' + 'message argument');
779
- }
780
-
781
- if (!condition) {
782
- for (var _len2 = arguments.length, args = new Array(_len2 > 2 ? _len2 - 2 : 0), _key2 = 2; _key2 < _len2; _key2++) {
783
- args[_key2 - 2] = arguments[_key2];
784
- }
785
-
786
- printWarning.apply(void 0, [format].concat(args));
787
- }
788
- };
789
- }
790
-
791
- var lowPriorityWarningWithoutStack$1 = lowPriorityWarningWithoutStack;
792
-
793
634
  /**
794
635
  * HTML nodeType values that represent the type of the node
795
636
  */
@@ -913,7 +754,6 @@ var TOP_CONTEXT_MENU = unsafeCastStringToDOMTopLevelType('contextmenu');
913
754
  var TOP_COPY = unsafeCastStringToDOMTopLevelType('copy');
914
755
  var TOP_CUT = unsafeCastStringToDOMTopLevelType('cut');
915
756
  var TOP_DOUBLE_CLICK = unsafeCastStringToDOMTopLevelType('dblclick');
916
-
917
757
  var TOP_DRAG = unsafeCastStringToDOMTopLevelType('drag');
918
758
  var TOP_DRAG_END = unsafeCastStringToDOMTopLevelType('dragend');
919
759
  var TOP_DRAG_ENTER = unsafeCastStringToDOMTopLevelType('dragenter');
@@ -928,9 +768,7 @@ var TOP_ENCRYPTED = unsafeCastStringToDOMTopLevelType('encrypted');
928
768
  var TOP_ENDED = unsafeCastStringToDOMTopLevelType('ended');
929
769
  var TOP_ERROR = unsafeCastStringToDOMTopLevelType('error');
930
770
  var TOP_FOCUS = unsafeCastStringToDOMTopLevelType('focus');
931
-
932
771
  var TOP_INPUT = unsafeCastStringToDOMTopLevelType('input');
933
-
934
772
  var TOP_KEY_DOWN = unsafeCastStringToDOMTopLevelType('keydown');
935
773
  var TOP_KEY_PRESS = unsafeCastStringToDOMTopLevelType('keypress');
936
774
  var TOP_KEY_UP = unsafeCastStringToDOMTopLevelType('keyup');
@@ -938,7 +776,6 @@ var TOP_LOAD = unsafeCastStringToDOMTopLevelType('load');
938
776
  var TOP_LOAD_START = unsafeCastStringToDOMTopLevelType('loadstart');
939
777
  var TOP_LOADED_DATA = unsafeCastStringToDOMTopLevelType('loadeddata');
940
778
  var TOP_LOADED_METADATA = unsafeCastStringToDOMTopLevelType('loadedmetadata');
941
-
942
779
  var TOP_MOUSE_DOWN = unsafeCastStringToDOMTopLevelType('mousedown');
943
780
  var TOP_MOUSE_MOVE = unsafeCastStringToDOMTopLevelType('mousemove');
944
781
  var TOP_MOUSE_OUT = unsafeCastStringToDOMTopLevelType('mouseout');
@@ -948,23 +785,13 @@ var TOP_PASTE = unsafeCastStringToDOMTopLevelType('paste');
948
785
  var TOP_PAUSE = unsafeCastStringToDOMTopLevelType('pause');
949
786
  var TOP_PLAY = unsafeCastStringToDOMTopLevelType('play');
950
787
  var TOP_PLAYING = unsafeCastStringToDOMTopLevelType('playing');
951
-
952
-
953
-
954
-
955
-
956
-
957
-
958
-
959
788
  var TOP_PROGRESS = unsafeCastStringToDOMTopLevelType('progress');
960
789
  var TOP_RATE_CHANGE = unsafeCastStringToDOMTopLevelType('ratechange');
961
-
962
790
  var TOP_SCROLL = unsafeCastStringToDOMTopLevelType('scroll');
963
791
  var TOP_SEEKED = unsafeCastStringToDOMTopLevelType('seeked');
964
792
  var TOP_SEEKING = unsafeCastStringToDOMTopLevelType('seeking');
965
793
  var TOP_SELECTION_CHANGE = unsafeCastStringToDOMTopLevelType('selectionchange');
966
794
  var TOP_STALLED = unsafeCastStringToDOMTopLevelType('stalled');
967
-
968
795
  var TOP_SUSPEND = unsafeCastStringToDOMTopLevelType('suspend');
969
796
  var TOP_TEXT_INPUT = unsafeCastStringToDOMTopLevelType('textInput');
970
797
  var TOP_TIME_UPDATE = unsafeCastStringToDOMTopLevelType('timeupdate');
@@ -977,58 +804,66 @@ var TOP_TRANSITION_END = unsafeCastStringToDOMTopLevelType(getVendorPrefixedEven
977
804
  var TOP_VOLUME_CHANGE = unsafeCastStringToDOMTopLevelType('volumechange');
978
805
  var TOP_WAITING = unsafeCastStringToDOMTopLevelType('waiting');
979
806
  var TOP_WHEEL = unsafeCastStringToDOMTopLevelType('wheel'); // List of events that need to be individually attached to media elements.
980
- // Note that events in this list will *not* be listened to at the top level
981
- // unless they're explicitly whitelisted in `ReactBrowserEventEmitter.listenTo`.
982
807
 
983
808
  var PLUGIN_EVENT_SYSTEM = 1;
984
809
 
985
810
  var didWarnAboutMessageChannel = false;
986
- var enqueueTask;
987
-
988
- try {
989
- // read require off the module object to get around the bundlers.
990
- // we don't want them to detect a require and bundle a Node polyfill.
991
- var requireString = ('require' + Math.random()).slice(0, 7);
992
- var nodeRequire = module && module[requireString]; // assuming we're in node, let's try to get node's
993
- // version of setImmediate, bypassing fake timers if any.
994
-
995
- enqueueTask = nodeRequire('timers').setImmediate;
996
- } catch (_err) {
997
- // we're in a browser
998
- // we can't use regular timers because they may still be faked
999
- // so we try MessageChannel+postMessage instead
1000
- enqueueTask = function (callback) {
1001
- {
1002
- if (didWarnAboutMessageChannel === false) {
1003
- didWarnAboutMessageChannel = true;
1004
- !(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;
1005
- }
811
+ var enqueueTaskImpl = null;
812
+ function enqueueTask(task) {
813
+ if (enqueueTaskImpl === null) {
814
+ try {
815
+ // read require off the module object to get around the bundlers.
816
+ // we don't want them to detect a require and bundle a Node polyfill.
817
+ var requireString = ('require' + Math.random()).slice(0, 7);
818
+ var nodeRequire = module && module[requireString]; // assuming we're in node, let's try to get node's
819
+ // version of setImmediate, bypassing fake timers if any.
820
+
821
+ enqueueTaskImpl = nodeRequire('timers').setImmediate;
822
+ } catch (_err) {
823
+ // we're in a browser
824
+ // we can't use regular timers because they may still be faked
825
+ // so we try MessageChannel+postMessage instead
826
+ enqueueTaskImpl = function (callback) {
827
+ {
828
+ if (didWarnAboutMessageChannel === false) {
829
+ didWarnAboutMessageChannel = true;
830
+
831
+ if (typeof MessageChannel === 'undefined') {
832
+ error('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.');
833
+ }
834
+ }
835
+ }
836
+
837
+ var channel = new MessageChannel();
838
+ channel.port1.onmessage = callback;
839
+ channel.port2.postMessage(undefined);
840
+ };
1006
841
  }
842
+ }
1007
843
 
1008
- var channel = new MessageChannel();
1009
- channel.port1.onmessage = callback;
1010
- channel.port2.postMessage(undefined);
1011
- };
844
+ return enqueueTaskImpl(task);
1012
845
  }
1013
846
 
1014
- var enqueueTask$1 = enqueueTask;
1015
-
1016
847
  // ReactDOM.js, and ReactTestUtils.js:
1017
848
 
1018
- var _ReactDOM$__SECRET_IN$1 = ReactDOM.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.Events;
1019
- var getInstanceFromNode$1 = _ReactDOM$__SECRET_IN$1[0];
1020
- var getNodeFromInstance$1 = _ReactDOM$__SECRET_IN$1[1];
1021
- var getFiberCurrentPropsFromNode$1 = _ReactDOM$__SECRET_IN$1[2];
1022
- var injectEventPluginsByName$1 = _ReactDOM$__SECRET_IN$1[3];
1023
- var eventNameDispatchConfigs$1 = _ReactDOM$__SECRET_IN$1[4];
1024
- var accumulateTwoPhaseDispatches$1 = _ReactDOM$__SECRET_IN$1[5];
1025
- var accumulateDirectDispatches$1 = _ReactDOM$__SECRET_IN$1[6];
1026
- var enqueueStateRestore$1 = _ReactDOM$__SECRET_IN$1[7];
1027
- var restoreStateIfNeeded$1 = _ReactDOM$__SECRET_IN$1[8];
1028
- var dispatchEvent$1 = _ReactDOM$__SECRET_IN$1[9];
1029
- var runEventsInBatch$1 = _ReactDOM$__SECRET_IN$1[10];
1030
- var flushPassiveEffects$1 = _ReactDOM$__SECRET_IN$1[11];
1031
- var IsThisRendererActing$1 = _ReactDOM$__SECRET_IN$1[12];
849
+ var _ReactDOM$__SECRET_IN = ReactDOM.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.Events,
850
+
851
+ /* eslint-disable no-unused-vars */
852
+ getInstanceFromNode = _ReactDOM$__SECRET_IN[0],
853
+ getNodeFromInstance = _ReactDOM$__SECRET_IN[1],
854
+ getFiberCurrentPropsFromNode = _ReactDOM$__SECRET_IN[2],
855
+ injectEventPluginsByName = _ReactDOM$__SECRET_IN[3],
856
+ eventNameDispatchConfigs = _ReactDOM$__SECRET_IN[4],
857
+ accumulateTwoPhaseDispatches = _ReactDOM$__SECRET_IN[5],
858
+ accumulateDirectDispatches = _ReactDOM$__SECRET_IN[6],
859
+ enqueueStateRestore = _ReactDOM$__SECRET_IN[7],
860
+ restoreStateIfNeeded = _ReactDOM$__SECRET_IN[8],
861
+ dispatchEvent = _ReactDOM$__SECRET_IN[9],
862
+ runEventsInBatch = _ReactDOM$__SECRET_IN[10],
863
+
864
+ /* eslint-enable no-unused-vars */
865
+ flushPassiveEffects = _ReactDOM$__SECRET_IN[11],
866
+ IsThisRendererActing = _ReactDOM$__SECRET_IN[12];
1032
867
  var batchedUpdates = ReactDOM.unstable_batchedUpdates;
1033
868
  var IsSomeRendererActing = ReactSharedInternals.IsSomeRendererActing; // this implementation should be exactly the same in
1034
869
  // ReactTestUtilsAct.js, ReactTestRendererAct.js, createReactNoop.js
@@ -1038,7 +873,7 @@ var isSchedulerMocked = typeof Scheduler.unstable_flushAllWithoutAsserting === '
1038
873
  var flushWork = Scheduler.unstable_flushAllWithoutAsserting || function () {
1039
874
  var didFlushWork = false;
1040
875
 
1041
- while (flushPassiveEffects$1()) {
876
+ while (flushPassiveEffects()) {
1042
877
  didFlushWork = true;
1043
878
  }
1044
879
 
@@ -1048,7 +883,7 @@ var flushWork = Scheduler.unstable_flushAllWithoutAsserting || function () {
1048
883
  function flushWorkAndMicroTasks(onDone) {
1049
884
  try {
1050
885
  flushWork();
1051
- enqueueTask$1(function () {
886
+ enqueueTask(function () {
1052
887
  if (flushWork()) {
1053
888
  flushWorkAndMicroTasks(onDone);
1054
889
  } else {
@@ -1063,25 +898,27 @@ function flushWorkAndMicroTasks(onDone) {
1063
898
 
1064
899
 
1065
900
  var actingUpdatesScopeDepth = 0;
901
+
1066
902
  function act(callback) {
903
+
1067
904
  var previousActingUpdatesScopeDepth = actingUpdatesScopeDepth;
1068
905
  var previousIsSomeRendererActing;
1069
906
  var previousIsThisRendererActing;
1070
907
  actingUpdatesScopeDepth++;
1071
908
  previousIsSomeRendererActing = IsSomeRendererActing.current;
1072
- previousIsThisRendererActing = IsThisRendererActing$1.current;
909
+ previousIsThisRendererActing = IsThisRendererActing.current;
1073
910
  IsSomeRendererActing.current = true;
1074
- IsThisRendererActing$1.current = true;
911
+ IsThisRendererActing.current = true;
1075
912
 
1076
913
  function onDone() {
1077
914
  actingUpdatesScopeDepth--;
1078
915
  IsSomeRendererActing.current = previousIsSomeRendererActing;
1079
- IsThisRendererActing$1.current = previousIsThisRendererActing;
916
+ IsThisRendererActing.current = previousIsThisRendererActing;
1080
917
 
1081
918
  {
1082
919
  if (actingUpdatesScopeDepth > previousActingUpdatesScopeDepth) {
1083
920
  // if it's _less than_ previousActingUpdatesScopeDepth, then we can assume the 'other' one has warned
1084
- 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. ');
921
+ error('You seem to have overlapping act() calls, this is not supported. ' + 'Be sure to await previous act() calls before making a new one. ');
1085
922
  }
1086
923
  }
1087
924
  }
@@ -1106,7 +943,7 @@ function act(callback) {
1106
943
  //eslint-disable-next-line no-undef
1107
944
  Promise.resolve().then(function () {}).then(function () {
1108
945
  if (called === false) {
1109
- 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 () => ...);');
946
+ error('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 () => ...);');
1110
947
  }
1111
948
  });
1112
949
  }
@@ -1144,7 +981,9 @@ function act(callback) {
1144
981
  };
1145
982
  } else {
1146
983
  {
1147
- !(result === undefined) ? warningWithoutStack$1(false, 'The callback passed to act(...) function ' + 'must return undefined, or a Promise. You returned %s', result) : void 0;
984
+ if (result !== undefined) {
985
+ error('The callback passed to act(...) function ' + 'must return undefined, or a Promise. You returned %s', result);
986
+ }
1148
987
  } // flush effects until none remain, and cleanup
1149
988
 
1150
989
 
@@ -1165,7 +1004,7 @@ function act(callback) {
1165
1004
  return {
1166
1005
  then: function (resolve) {
1167
1006
  {
1168
- warningWithoutStack$1(false, 'Do not await the result of calling act(...) with sync logic, it is not a Promise.');
1007
+ error('Do not await the result of calling act(...) with sync logic, it is not a Promise.');
1169
1008
  }
1170
1009
 
1171
1010
  resolve();
@@ -1177,20 +1016,28 @@ function act(callback) {
1177
1016
  var findDOMNode = ReactDOM.findDOMNode; // Keep in sync with ReactDOMUnstableNativeDependencies.js
1178
1017
  // ReactDOM.js, and ReactTestUtilsAct.js:
1179
1018
 
1180
- var _ReactDOM$__SECRET_IN = ReactDOM.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.Events;
1181
- var getInstanceFromNode = _ReactDOM$__SECRET_IN[0];
1182
- var getNodeFromInstance = _ReactDOM$__SECRET_IN[1];
1183
- var getFiberCurrentPropsFromNode = _ReactDOM$__SECRET_IN[2];
1184
- var injectEventPluginsByName = _ReactDOM$__SECRET_IN[3];
1185
- var eventNameDispatchConfigs = _ReactDOM$__SECRET_IN[4];
1186
- var accumulateTwoPhaseDispatches = _ReactDOM$__SECRET_IN[5];
1187
- var accumulateDirectDispatches = _ReactDOM$__SECRET_IN[6];
1188
- var enqueueStateRestore = _ReactDOM$__SECRET_IN[7];
1189
- var restoreStateIfNeeded = _ReactDOM$__SECRET_IN[8];
1190
- var dispatchEvent = _ReactDOM$__SECRET_IN[9];
1191
- var runEventsInBatch = _ReactDOM$__SECRET_IN[10];
1192
- var flushPassiveEffects = _ReactDOM$__SECRET_IN[11];
1193
- var IsThisRendererActing = _ReactDOM$__SECRET_IN[12];
1019
+ var _ReactDOM$__SECRET_IN$1 = ReactDOM.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.Events,
1020
+ getInstanceFromNode$1 = _ReactDOM$__SECRET_IN$1[0],
1021
+
1022
+ /* eslint-disable no-unused-vars */
1023
+ getNodeFromInstance$1 = _ReactDOM$__SECRET_IN$1[1],
1024
+ getFiberCurrentPropsFromNode$1 = _ReactDOM$__SECRET_IN$1[2],
1025
+ injectEventPluginsByName$1 = _ReactDOM$__SECRET_IN$1[3],
1026
+
1027
+ /* eslint-enable no-unused-vars */
1028
+ eventNameDispatchConfigs$1 = _ReactDOM$__SECRET_IN$1[4],
1029
+ accumulateTwoPhaseDispatches$1 = _ReactDOM$__SECRET_IN$1[5],
1030
+ accumulateDirectDispatches$1 = _ReactDOM$__SECRET_IN$1[6],
1031
+ enqueueStateRestore$1 = _ReactDOM$__SECRET_IN$1[7],
1032
+ restoreStateIfNeeded$1 = _ReactDOM$__SECRET_IN$1[8],
1033
+ dispatchEvent$1 = _ReactDOM$__SECRET_IN$1[9],
1034
+ runEventsInBatch$1 = _ReactDOM$__SECRET_IN$1[10],
1035
+
1036
+ /* eslint-disable no-unused-vars */
1037
+ flushPassiveEffects$1 = _ReactDOM$__SECRET_IN$1[11],
1038
+ IsThisRendererActing$1
1039
+ /* eslint-enable no-unused-vars */
1040
+ = _ReactDOM$__SECRET_IN$1[12];
1194
1041
 
1195
1042
  function Event(suffix) {}
1196
1043
 
@@ -1209,7 +1056,7 @@ var hasWarnedAboutDeprecatedMockComponent = false;
1209
1056
 
1210
1057
  function simulateNativeEventOnNode(topLevelType, node, fakeNativeEvent) {
1211
1058
  fakeNativeEvent.target = node;
1212
- dispatchEvent(topLevelType, PLUGIN_EVENT_SYSTEM, fakeNativeEvent);
1059
+ dispatchEvent$1(topLevelType, PLUGIN_EVENT_SYSTEM, document, fakeNativeEvent);
1213
1060
  }
1214
1061
  /**
1215
1062
  * Simulates a top level event being dispatched from a raw event that occurred
@@ -1296,7 +1143,7 @@ function validateClassInstance(inst, methodName) {
1296
1143
 
1297
1144
  {
1298
1145
  {
1299
- throw Error(methodName + "(...): the first argument must be a React class instance. Instead received: " + received + ".");
1146
+ throw Error( methodName + "(...): the first argument must be a React class instance. Instead received: " + received + "." );
1300
1147
  }
1301
1148
  }
1302
1149
  }
@@ -1383,7 +1230,7 @@ var ReactTestUtils = {
1383
1230
  if (!Array.isArray(classNames)) {
1384
1231
  if (!(classNames !== undefined)) {
1385
1232
  {
1386
- throw Error("TestUtils.scryRenderedDOMComponentsWithClass expects a className as a second argument.");
1233
+ throw Error( "TestUtils.scryRenderedDOMComponentsWithClass expects a className as a second argument." );
1387
1234
  }
1388
1235
  }
1389
1236
 
@@ -1487,9 +1334,12 @@ var ReactTestUtils = {
1487
1334
  * @return {object} the ReactTestUtils object (for chaining)
1488
1335
  */
1489
1336
  mockComponent: function (module, mockTagName) {
1490
- if (!hasWarnedAboutDeprecatedMockComponent) {
1491
- hasWarnedAboutDeprecatedMockComponent = true;
1492
- lowPriorityWarningWithoutStack$1(false, 'ReactTestUtils.mockComponent() is deprecated. ' + 'Use shallow rendering or jest.mock() instead.\n\n' + 'See https://fb.me/test-utils-mock-component for more information.');
1337
+ {
1338
+ if (!hasWarnedAboutDeprecatedMockComponent) {
1339
+ hasWarnedAboutDeprecatedMockComponent = true;
1340
+
1341
+ warn('ReactTestUtils.mockComponent() is deprecated. ' + 'Use shallow rendering or jest.mock() instead.\n\n' + 'See https://fb.me/test-utils-mock-component for more information.');
1342
+ }
1493
1343
  }
1494
1344
 
1495
1345
  mockTagName = mockTagName || module.mockTagName || 'div';
@@ -1523,23 +1373,23 @@ function makeSimulator(eventType) {
1523
1373
  return function (domNode, eventData) {
1524
1374
  if (!!React.isValidElement(domNode)) {
1525
1375
  {
1526
- throw 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.");
1376
+ throw 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." );
1527
1377
  }
1528
1378
  }
1529
1379
 
1530
1380
  if (!!ReactTestUtils.isCompositeComponent(domNode)) {
1531
1381
  {
1532
- throw 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.");
1382
+ throw 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." );
1533
1383
  }
1534
1384
  }
1535
1385
 
1536
- var dispatchConfig = eventNameDispatchConfigs[eventType];
1386
+ var dispatchConfig = eventNameDispatchConfigs$1[eventType];
1537
1387
  var fakeNativeEvent = new Event();
1538
1388
  fakeNativeEvent.target = domNode;
1539
1389
  fakeNativeEvent.type = eventType.toLowerCase(); // We don't use SyntheticEvent.getPooled in order to not have to worry about
1540
1390
  // properly destroying any properties assigned from `eventData` upon release
1541
1391
 
1542
- var targetInst = getInstanceFromNode(domNode);
1392
+ var targetInst = getInstanceFromNode$1(domNode);
1543
1393
  var event = new SyntheticEvent(dispatchConfig, targetInst, fakeNativeEvent, domNode); // Since we aren't using pooling, always persist the event. This will make
1544
1394
  // sure it's marked and won't warn when setting additional properties.
1545
1395
 
@@ -1548,18 +1398,18 @@ function makeSimulator(eventType) {
1548
1398
  _assign(event, eventData);
1549
1399
 
1550
1400
  if (dispatchConfig.phasedRegistrationNames) {
1551
- accumulateTwoPhaseDispatches(event);
1401
+ accumulateTwoPhaseDispatches$1(event);
1552
1402
  } else {
1553
- accumulateDirectDispatches(event);
1403
+ accumulateDirectDispatches$1(event);
1554
1404
  }
1555
1405
 
1556
1406
  ReactDOM.unstable_batchedUpdates(function () {
1557
1407
  // Normally extractEvent enqueues a state restore, but we'll just always
1558
1408
  // do that since we're by-passing it here.
1559
- enqueueStateRestore(domNode);
1560
- runEventsInBatch(event);
1409
+ enqueueStateRestore$1(domNode);
1410
+ runEventsInBatch$1(event);
1561
1411
  });
1562
- restoreStateIfNeeded();
1412
+ restoreStateIfNeeded$1();
1563
1413
  };
1564
1414
  }
1565
1415
 
@@ -1567,7 +1417,7 @@ function buildSimulators() {
1567
1417
  ReactTestUtils.Simulate = {};
1568
1418
  var eventType;
1569
1419
 
1570
- for (eventType in eventNameDispatchConfigs) {
1420
+ for (eventType in eventNameDispatchConfigs$1) {
1571
1421
  /**
1572
1422
  * @param {!Element|ReactDOMComponent} domComponentOrNode
1573
1423
  * @param {?object} eventData Fake event data to use in SyntheticEvent.
@@ -1619,18 +1469,11 @@ function makeNativeSimulator(eventType, topLevelType) {
1619
1469
  ReactTestUtils.SimulateNative[eventType] = makeNativeSimulator(eventType, topLevelType);
1620
1470
  });
1621
1471
 
1622
-
1623
- var ReactTestUtils$2 = Object.freeze({
1624
- default: ReactTestUtils
1625
- });
1626
-
1627
- var ReactTestUtils$3 = ( ReactTestUtils$2 && ReactTestUtils ) || ReactTestUtils$2;
1628
-
1629
1472
  // TODO: decide on the top-level export form.
1630
1473
  // This is hacky but makes it work with both Rollup and Jest.
1631
1474
 
1632
1475
 
1633
- var testUtils = ReactTestUtils$3.default || ReactTestUtils$3;
1476
+ var testUtils = ReactTestUtils.default || ReactTestUtils;
1634
1477
 
1635
1478
  module.exports = testUtils;
1636
1479
  })();