react-dom 16.11.0 → 16.14.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 (28) hide show
  1. package/build-info.json +5 -5
  2. package/cjs/react-dom-server.browser.development.js +331 -596
  3. package/cjs/react-dom-server.browser.production.min.js +37 -37
  4. package/cjs/react-dom-server.node.development.js +330 -595
  5. package/cjs/react-dom-server.node.production.min.js +38 -38
  6. package/cjs/react-dom-test-utils.development.js +171 -326
  7. package/cjs/react-dom-test-utils.production.min.js +17 -17
  8. package/cjs/react-dom-unstable-fizz.browser.development.js +11 -25
  9. package/cjs/react-dom-unstable-fizz.browser.production.min.js +3 -3
  10. package/cjs/react-dom-unstable-fizz.node.development.js +24 -27
  11. package/cjs/react-dom-unstable-fizz.node.production.min.js +4 -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 +9554 -12269
  15. package/cjs/react-dom.production.min.js +280 -278
  16. package/cjs/react-dom.profiling.min.js +285 -282
  17. package/package.json +30 -25
  18. package/umd/react-dom-server.browser.development.js +3320 -3596
  19. package/umd/react-dom-server.browser.production.min.js +35 -35
  20. package/umd/react-dom-test-utils.development.js +1200 -1355
  21. package/umd/react-dom-test-utils.production.min.js +23 -23
  22. package/umd/react-dom-unstable-fizz.browser.development.js +105 -119
  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 +19871 -22597
  27. package/umd/react-dom.production.min.js +229 -231
  28. package/umd/react-dom.profiling.min.js +237 -239
@@ -1,4 +1,4 @@
1
- /** @license React v16.11.0
1
+ /** @license React v16.14.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;
68
+
69
+ if (!hasExistingStack) {
70
+ var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;
71
+ var stack = ReactDebugCurrentFrame.getStackAddendum();
71
72
 
72
- Function.prototype.apply.call(console.error, console, argsWithFormat);
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,82 +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 begin-phase lifecycle hooks and setState reducers:
178
-
179
- // In some cases, StrictMode should also double-render lifecycles.
180
- // This can be confusing for tests though,
181
- // And it can be bad for performance in production.
182
- // This feature flag can be used to control the behavior:
183
-
184
- // To preserve the "Pause on caught exceptions" behavior of the debugger, we
185
- // replay the begin phase of a failed component inside invokeGuardedCallback.
186
-
187
- // Warn about deprecated, async-unsafe lifecycles; relates to RFC #6:
188
-
189
- // Gather advanced timing metrics for Profiler subtrees.
190
-
191
- // Trace which interactions trigger each commit.
192
-
193
- // SSR experiments
194
-
195
-
196
- // Only used in www builds.
197
-
198
- // Only used in www builds.
199
-
200
- // Disable javascript: URL strings in href for XSS protection.
201
-
202
- // React Fire: prevent the value and checked attributes from syncing
203
- // with their related DOM properties
204
-
205
- // These APIs will no longer be "unstable" in the upcoming 16.7 release,
206
- // Control this behavior with a flag to support 16.6 minor releases in the meanwhile.
207
-
208
-
209
- // Experimental React Flare event system and event components support.
210
-
211
- // Experimental Host Component support.
212
-
213
- // Experimental Scope support.
214
-
215
- // New API for JSX transforms to target - https://github.com/reactjs/rfcs/pull/107
216
-
217
- // We will enforce mocking scheduler with scheduler/unstable_mock at some point. (v17?)
218
- // Till then, we warn about the missing mock, but still fallback to a sync mode compatible version
219
-
220
- // For tests, we flush suspense fallbacks in an act scope;
221
- // *except* in some of our own tests, where we test incremental loading states.
222
-
223
- // Add a callback property to suspense to notify which promises are currently
224
- // in the update queue. This allows reporting and tracing of what is causing
225
- // the user to see a loading state.
226
- // Also allows hydration callbacks to fire when a dehydrated boundary gets
227
- // hydrated or deleted.
228
-
229
- // Part of the simplification of React.createElement so we can eventually move
230
- // from React.createElement to React.jsx
231
- // https://github.com/reactjs/rfcs/blob/createlement-rfc/text/0000-create-element-changes.md
232
134
 
233
135
  var ReactCurrentOwner = ReactSharedInternals.ReactCurrentOwner;
234
136
  function getNearestMountedFiber(fiber) {
@@ -269,14 +171,10 @@ function getNearestMountedFiber(fiber) {
269
171
  return null;
270
172
  }
271
173
 
272
-
273
-
274
-
275
-
276
174
  function assertIsMounted(fiber) {
277
175
  if (!(getNearestMountedFiber(fiber) === fiber)) {
278
176
  {
279
- throw Error("Unable to find node on an unmounted component.");
177
+ throw Error( "Unable to find node on an unmounted component." );
280
178
  }
281
179
  }
282
180
  }
@@ -290,7 +188,7 @@ function findCurrentFiberUsingSlowPath(fiber) {
290
188
 
291
189
  if (!(nearestMounted !== null)) {
292
190
  {
293
- throw Error("Unable to find node on an unmounted component.");
191
+ throw Error( "Unable to find node on an unmounted component." );
294
192
  }
295
193
  }
296
194
 
@@ -359,7 +257,7 @@ function findCurrentFiberUsingSlowPath(fiber) {
359
257
 
360
258
  {
361
259
  {
362
- throw Error("Unable to find node on an unmounted component.");
260
+ throw Error( "Unable to find node on an unmounted component." );
363
261
  }
364
262
  }
365
263
  }
@@ -422,7 +320,7 @@ function findCurrentFiberUsingSlowPath(fiber) {
422
320
 
423
321
  if (!didFindChild) {
424
322
  {
425
- 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." );
426
324
  }
427
325
  }
428
326
  }
@@ -430,7 +328,7 @@ function findCurrentFiberUsingSlowPath(fiber) {
430
328
 
431
329
  if (!(a.alternate === b)) {
432
330
  {
433
- 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." );
434
332
  }
435
333
  }
436
334
  } // If the root is not a host container, we're in a disconnected tree. I.e.
@@ -439,7 +337,7 @@ function findCurrentFiberUsingSlowPath(fiber) {
439
337
 
440
338
  if (!(a.tag === HostRoot)) {
441
339
  {
442
- throw Error("Unable to find node on an unmounted component.");
340
+ throw Error( "Unable to find node on an unmounted component." );
443
341
  }
444
342
  }
445
343
 
@@ -452,7 +350,6 @@ function findCurrentFiberUsingSlowPath(fiber) {
452
350
  return alternate;
453
351
  }
454
352
 
455
- /* eslint valid-typeof: 0 */
456
353
  var EVENT_POOL_SIZE = 10;
457
354
  /**
458
355
  * @interface Event
@@ -694,8 +591,9 @@ function getPooledWarningPropertyDefinition(propName, getVal) {
694
591
  }
695
592
 
696
593
  function warn(action, result) {
697
- var warningCondition = false;
698
- !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
+ }
699
597
  }
700
598
  }
701
599
 
@@ -716,7 +614,7 @@ function releasePooledEvent(event) {
716
614
 
717
615
  if (!(event instanceof EventConstructor)) {
718
616
  {
719
- 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." );
720
618
  }
721
619
  }
722
620
 
@@ -733,61 +631,6 @@ function addEventPoolingTo(EventConstructor) {
733
631
  EventConstructor.release = releasePooledEvent;
734
632
  }
735
633
 
736
- /**
737
- * Forked from fbjs/warning:
738
- * https://github.com/facebook/fbjs/blob/e66ba20ad5be433eb54423f2b097d829324d9de6/packages/fbjs/src/__forks__/warning.js
739
- *
740
- * Only change is we use console.warn instead of console.error,
741
- * and do nothing when 'console' is not supported.
742
- * This really simplifies the code.
743
- * ---
744
- * Similar to invariant but only logs a warning if the condition is not met.
745
- * This can be used to log issues in development environments in critical
746
- * paths. Removing the logging code for production environments will keep the
747
- * same logic and follow the same code paths.
748
- */
749
- var lowPriorityWarningWithoutStack = function () {};
750
-
751
- {
752
- var printWarning = function (format) {
753
- for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
754
- args[_key - 1] = arguments[_key];
755
- }
756
-
757
- var argIndex = 0;
758
- var message = 'Warning: ' + format.replace(/%s/g, function () {
759
- return args[argIndex++];
760
- });
761
-
762
- if (typeof console !== 'undefined') {
763
- console.warn(message);
764
- }
765
-
766
- try {
767
- // --- Welcome to debugging React ---
768
- // This error was thrown as a convenience so that you can use this stack
769
- // to find the callsite that caused this warning to fire.
770
- throw new Error(message);
771
- } catch (x) {}
772
- };
773
-
774
- lowPriorityWarningWithoutStack = function (condition, format) {
775
- if (format === undefined) {
776
- throw new Error('`lowPriorityWarningWithoutStack(condition, format, ...args)` requires a warning ' + 'message argument');
777
- }
778
-
779
- if (!condition) {
780
- for (var _len2 = arguments.length, args = new Array(_len2 > 2 ? _len2 - 2 : 0), _key2 = 2; _key2 < _len2; _key2++) {
781
- args[_key2 - 2] = arguments[_key2];
782
- }
783
-
784
- printWarning.apply(void 0, [format].concat(args));
785
- }
786
- };
787
- }
788
-
789
- var lowPriorityWarningWithoutStack$1 = lowPriorityWarningWithoutStack;
790
-
791
634
  /**
792
635
  * HTML nodeType values that represent the type of the node
793
636
  */
@@ -911,7 +754,6 @@ var TOP_CONTEXT_MENU = unsafeCastStringToDOMTopLevelType('contextmenu');
911
754
  var TOP_COPY = unsafeCastStringToDOMTopLevelType('copy');
912
755
  var TOP_CUT = unsafeCastStringToDOMTopLevelType('cut');
913
756
  var TOP_DOUBLE_CLICK = unsafeCastStringToDOMTopLevelType('dblclick');
914
-
915
757
  var TOP_DRAG = unsafeCastStringToDOMTopLevelType('drag');
916
758
  var TOP_DRAG_END = unsafeCastStringToDOMTopLevelType('dragend');
917
759
  var TOP_DRAG_ENTER = unsafeCastStringToDOMTopLevelType('dragenter');
@@ -926,9 +768,7 @@ var TOP_ENCRYPTED = unsafeCastStringToDOMTopLevelType('encrypted');
926
768
  var TOP_ENDED = unsafeCastStringToDOMTopLevelType('ended');
927
769
  var TOP_ERROR = unsafeCastStringToDOMTopLevelType('error');
928
770
  var TOP_FOCUS = unsafeCastStringToDOMTopLevelType('focus');
929
-
930
771
  var TOP_INPUT = unsafeCastStringToDOMTopLevelType('input');
931
-
932
772
  var TOP_KEY_DOWN = unsafeCastStringToDOMTopLevelType('keydown');
933
773
  var TOP_KEY_PRESS = unsafeCastStringToDOMTopLevelType('keypress');
934
774
  var TOP_KEY_UP = unsafeCastStringToDOMTopLevelType('keyup');
@@ -936,7 +776,6 @@ var TOP_LOAD = unsafeCastStringToDOMTopLevelType('load');
936
776
  var TOP_LOAD_START = unsafeCastStringToDOMTopLevelType('loadstart');
937
777
  var TOP_LOADED_DATA = unsafeCastStringToDOMTopLevelType('loadeddata');
938
778
  var TOP_LOADED_METADATA = unsafeCastStringToDOMTopLevelType('loadedmetadata');
939
-
940
779
  var TOP_MOUSE_DOWN = unsafeCastStringToDOMTopLevelType('mousedown');
941
780
  var TOP_MOUSE_MOVE = unsafeCastStringToDOMTopLevelType('mousemove');
942
781
  var TOP_MOUSE_OUT = unsafeCastStringToDOMTopLevelType('mouseout');
@@ -946,23 +785,13 @@ var TOP_PASTE = unsafeCastStringToDOMTopLevelType('paste');
946
785
  var TOP_PAUSE = unsafeCastStringToDOMTopLevelType('pause');
947
786
  var TOP_PLAY = unsafeCastStringToDOMTopLevelType('play');
948
787
  var TOP_PLAYING = unsafeCastStringToDOMTopLevelType('playing');
949
-
950
-
951
-
952
-
953
-
954
-
955
-
956
-
957
788
  var TOP_PROGRESS = unsafeCastStringToDOMTopLevelType('progress');
958
789
  var TOP_RATE_CHANGE = unsafeCastStringToDOMTopLevelType('ratechange');
959
-
960
790
  var TOP_SCROLL = unsafeCastStringToDOMTopLevelType('scroll');
961
791
  var TOP_SEEKED = unsafeCastStringToDOMTopLevelType('seeked');
962
792
  var TOP_SEEKING = unsafeCastStringToDOMTopLevelType('seeking');
963
793
  var TOP_SELECTION_CHANGE = unsafeCastStringToDOMTopLevelType('selectionchange');
964
794
  var TOP_STALLED = unsafeCastStringToDOMTopLevelType('stalled');
965
-
966
795
  var TOP_SUSPEND = unsafeCastStringToDOMTopLevelType('suspend');
967
796
  var TOP_TEXT_INPUT = unsafeCastStringToDOMTopLevelType('textInput');
968
797
  var TOP_TIME_UPDATE = unsafeCastStringToDOMTopLevelType('timeupdate');
@@ -975,58 +804,66 @@ var TOP_TRANSITION_END = unsafeCastStringToDOMTopLevelType(getVendorPrefixedEven
975
804
  var TOP_VOLUME_CHANGE = unsafeCastStringToDOMTopLevelType('volumechange');
976
805
  var TOP_WAITING = unsafeCastStringToDOMTopLevelType('waiting');
977
806
  var TOP_WHEEL = unsafeCastStringToDOMTopLevelType('wheel'); // List of events that need to be individually attached to media elements.
978
- // Note that events in this list will *not* be listened to at the top level
979
- // unless they're explicitly whitelisted in `ReactBrowserEventEmitter.listenTo`.
980
807
 
981
808
  var PLUGIN_EVENT_SYSTEM = 1;
982
809
 
983
810
  var didWarnAboutMessageChannel = false;
984
- var enqueueTask;
985
-
986
- try {
987
- // read require off the module object to get around the bundlers.
988
- // we don't want them to detect a require and bundle a Node polyfill.
989
- var requireString = ('require' + Math.random()).slice(0, 7);
990
- var nodeRequire = module && module[requireString]; // assuming we're in node, let's try to get node's
991
- // version of setImmediate, bypassing fake timers if any.
992
-
993
- enqueueTask = nodeRequire('timers').setImmediate;
994
- } catch (_err) {
995
- // we're in a browser
996
- // we can't use regular timers because they may still be faked
997
- // so we try MessageChannel+postMessage instead
998
- enqueueTask = function (callback) {
999
- {
1000
- if (didWarnAboutMessageChannel === false) {
1001
- didWarnAboutMessageChannel = true;
1002
- !(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;
1003
- }
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
+ };
1004
841
  }
842
+ }
1005
843
 
1006
- var channel = new MessageChannel();
1007
- channel.port1.onmessage = callback;
1008
- channel.port2.postMessage(undefined);
1009
- };
844
+ return enqueueTaskImpl(task);
1010
845
  }
1011
846
 
1012
- var enqueueTask$1 = enqueueTask;
1013
-
1014
847
  // ReactDOM.js, and ReactTestUtils.js:
1015
848
 
1016
- var _ReactDOM$__SECRET_IN$1 = ReactDOM.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.Events;
1017
- var getInstanceFromNode$1 = _ReactDOM$__SECRET_IN$1[0];
1018
- var getNodeFromInstance$1 = _ReactDOM$__SECRET_IN$1[1];
1019
- var getFiberCurrentPropsFromNode$1 = _ReactDOM$__SECRET_IN$1[2];
1020
- var injectEventPluginsByName$1 = _ReactDOM$__SECRET_IN$1[3];
1021
- var eventNameDispatchConfigs$1 = _ReactDOM$__SECRET_IN$1[4];
1022
- var accumulateTwoPhaseDispatches$1 = _ReactDOM$__SECRET_IN$1[5];
1023
- var accumulateDirectDispatches$1 = _ReactDOM$__SECRET_IN$1[6];
1024
- var enqueueStateRestore$1 = _ReactDOM$__SECRET_IN$1[7];
1025
- var restoreStateIfNeeded$1 = _ReactDOM$__SECRET_IN$1[8];
1026
- var dispatchEvent$1 = _ReactDOM$__SECRET_IN$1[9];
1027
- var runEventsInBatch$1 = _ReactDOM$__SECRET_IN$1[10];
1028
- var flushPassiveEffects$1 = _ReactDOM$__SECRET_IN$1[11];
1029
- 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];
1030
867
  var batchedUpdates = ReactDOM.unstable_batchedUpdates;
1031
868
  var IsSomeRendererActing = ReactSharedInternals.IsSomeRendererActing; // this implementation should be exactly the same in
1032
869
  // ReactTestUtilsAct.js, ReactTestRendererAct.js, createReactNoop.js
@@ -1036,7 +873,7 @@ var isSchedulerMocked = typeof Scheduler.unstable_flushAllWithoutAsserting === '
1036
873
  var flushWork = Scheduler.unstable_flushAllWithoutAsserting || function () {
1037
874
  var didFlushWork = false;
1038
875
 
1039
- while (flushPassiveEffects$1()) {
876
+ while (flushPassiveEffects()) {
1040
877
  didFlushWork = true;
1041
878
  }
1042
879
 
@@ -1046,7 +883,7 @@ var flushWork = Scheduler.unstable_flushAllWithoutAsserting || function () {
1046
883
  function flushWorkAndMicroTasks(onDone) {
1047
884
  try {
1048
885
  flushWork();
1049
- enqueueTask$1(function () {
886
+ enqueueTask(function () {
1050
887
  if (flushWork()) {
1051
888
  flushWorkAndMicroTasks(onDone);
1052
889
  } else {
@@ -1061,25 +898,27 @@ function flushWorkAndMicroTasks(onDone) {
1061
898
 
1062
899
 
1063
900
  var actingUpdatesScopeDepth = 0;
901
+
1064
902
  function act(callback) {
903
+
1065
904
  var previousActingUpdatesScopeDepth = actingUpdatesScopeDepth;
1066
905
  var previousIsSomeRendererActing;
1067
906
  var previousIsThisRendererActing;
1068
907
  actingUpdatesScopeDepth++;
1069
908
  previousIsSomeRendererActing = IsSomeRendererActing.current;
1070
- previousIsThisRendererActing = IsThisRendererActing$1.current;
909
+ previousIsThisRendererActing = IsThisRendererActing.current;
1071
910
  IsSomeRendererActing.current = true;
1072
- IsThisRendererActing$1.current = true;
911
+ IsThisRendererActing.current = true;
1073
912
 
1074
913
  function onDone() {
1075
914
  actingUpdatesScopeDepth--;
1076
915
  IsSomeRendererActing.current = previousIsSomeRendererActing;
1077
- IsThisRendererActing$1.current = previousIsThisRendererActing;
916
+ IsThisRendererActing.current = previousIsThisRendererActing;
1078
917
 
1079
918
  {
1080
919
  if (actingUpdatesScopeDepth > previousActingUpdatesScopeDepth) {
1081
920
  // if it's _less than_ previousActingUpdatesScopeDepth, then we can assume the 'other' one has warned
1082
- 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. ');
1083
922
  }
1084
923
  }
1085
924
  }
@@ -1104,7 +943,7 @@ function act(callback) {
1104
943
  //eslint-disable-next-line no-undef
1105
944
  Promise.resolve().then(function () {}).then(function () {
1106
945
  if (called === false) {
1107
- 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 () => ...);');
1108
947
  }
1109
948
  });
1110
949
  }
@@ -1142,7 +981,9 @@ function act(callback) {
1142
981
  };
1143
982
  } else {
1144
983
  {
1145
- !(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
+ }
1146
987
  } // flush effects until none remain, and cleanup
1147
988
 
1148
989
 
@@ -1163,7 +1004,7 @@ function act(callback) {
1163
1004
  return {
1164
1005
  then: function (resolve) {
1165
1006
  {
1166
- 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.');
1167
1008
  }
1168
1009
 
1169
1010
  resolve();
@@ -1175,20 +1016,28 @@ function act(callback) {
1175
1016
  var findDOMNode = ReactDOM.findDOMNode; // Keep in sync with ReactDOMUnstableNativeDependencies.js
1176
1017
  // ReactDOM.js, and ReactTestUtilsAct.js:
1177
1018
 
1178
- var _ReactDOM$__SECRET_IN = ReactDOM.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.Events;
1179
- var getInstanceFromNode = _ReactDOM$__SECRET_IN[0];
1180
- var getNodeFromInstance = _ReactDOM$__SECRET_IN[1];
1181
- var getFiberCurrentPropsFromNode = _ReactDOM$__SECRET_IN[2];
1182
- var injectEventPluginsByName = _ReactDOM$__SECRET_IN[3];
1183
- var eventNameDispatchConfigs = _ReactDOM$__SECRET_IN[4];
1184
- var accumulateTwoPhaseDispatches = _ReactDOM$__SECRET_IN[5];
1185
- var accumulateDirectDispatches = _ReactDOM$__SECRET_IN[6];
1186
- var enqueueStateRestore = _ReactDOM$__SECRET_IN[7];
1187
- var restoreStateIfNeeded = _ReactDOM$__SECRET_IN[8];
1188
- var dispatchEvent = _ReactDOM$__SECRET_IN[9];
1189
- var runEventsInBatch = _ReactDOM$__SECRET_IN[10];
1190
- var flushPassiveEffects = _ReactDOM$__SECRET_IN[11];
1191
- 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];
1192
1041
 
1193
1042
  function Event(suffix) {}
1194
1043
 
@@ -1207,7 +1056,7 @@ var hasWarnedAboutDeprecatedMockComponent = false;
1207
1056
 
1208
1057
  function simulateNativeEventOnNode(topLevelType, node, fakeNativeEvent) {
1209
1058
  fakeNativeEvent.target = node;
1210
- dispatchEvent(topLevelType, PLUGIN_EVENT_SYSTEM, fakeNativeEvent);
1059
+ dispatchEvent$1(topLevelType, PLUGIN_EVENT_SYSTEM, document, fakeNativeEvent);
1211
1060
  }
1212
1061
  /**
1213
1062
  * Simulates a top level event being dispatched from a raw event that occurred
@@ -1294,7 +1143,7 @@ function validateClassInstance(inst, methodName) {
1294
1143
 
1295
1144
  {
1296
1145
  {
1297
- 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 + "." );
1298
1147
  }
1299
1148
  }
1300
1149
  }
@@ -1381,7 +1230,7 @@ var ReactTestUtils = {
1381
1230
  if (!Array.isArray(classNames)) {
1382
1231
  if (!(classNames !== undefined)) {
1383
1232
  {
1384
- throw Error("TestUtils.scryRenderedDOMComponentsWithClass expects a className as a second argument.");
1233
+ throw Error( "TestUtils.scryRenderedDOMComponentsWithClass expects a className as a second argument." );
1385
1234
  }
1386
1235
  }
1387
1236
 
@@ -1485,9 +1334,12 @@ var ReactTestUtils = {
1485
1334
  * @return {object} the ReactTestUtils object (for chaining)
1486
1335
  */
1487
1336
  mockComponent: function (module, mockTagName) {
1488
- if (!hasWarnedAboutDeprecatedMockComponent) {
1489
- hasWarnedAboutDeprecatedMockComponent = true;
1490
- 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
+ }
1491
1343
  }
1492
1344
 
1493
1345
  mockTagName = mockTagName || module.mockTagName || 'div';
@@ -1521,23 +1373,23 @@ function makeSimulator(eventType) {
1521
1373
  return function (domNode, eventData) {
1522
1374
  if (!!React.isValidElement(domNode)) {
1523
1375
  {
1524
- 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." );
1525
1377
  }
1526
1378
  }
1527
1379
 
1528
1380
  if (!!ReactTestUtils.isCompositeComponent(domNode)) {
1529
1381
  {
1530
- 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." );
1531
1383
  }
1532
1384
  }
1533
1385
 
1534
- var dispatchConfig = eventNameDispatchConfigs[eventType];
1386
+ var dispatchConfig = eventNameDispatchConfigs$1[eventType];
1535
1387
  var fakeNativeEvent = new Event();
1536
1388
  fakeNativeEvent.target = domNode;
1537
1389
  fakeNativeEvent.type = eventType.toLowerCase(); // We don't use SyntheticEvent.getPooled in order to not have to worry about
1538
1390
  // properly destroying any properties assigned from `eventData` upon release
1539
1391
 
1540
- var targetInst = getInstanceFromNode(domNode);
1392
+ var targetInst = getInstanceFromNode$1(domNode);
1541
1393
  var event = new SyntheticEvent(dispatchConfig, targetInst, fakeNativeEvent, domNode); // Since we aren't using pooling, always persist the event. This will make
1542
1394
  // sure it's marked and won't warn when setting additional properties.
1543
1395
 
@@ -1546,18 +1398,18 @@ function makeSimulator(eventType) {
1546
1398
  _assign(event, eventData);
1547
1399
 
1548
1400
  if (dispatchConfig.phasedRegistrationNames) {
1549
- accumulateTwoPhaseDispatches(event);
1401
+ accumulateTwoPhaseDispatches$1(event);
1550
1402
  } else {
1551
- accumulateDirectDispatches(event);
1403
+ accumulateDirectDispatches$1(event);
1552
1404
  }
1553
1405
 
1554
1406
  ReactDOM.unstable_batchedUpdates(function () {
1555
1407
  // Normally extractEvent enqueues a state restore, but we'll just always
1556
1408
  // do that since we're by-passing it here.
1557
- enqueueStateRestore(domNode);
1558
- runEventsInBatch(event);
1409
+ enqueueStateRestore$1(domNode);
1410
+ runEventsInBatch$1(event);
1559
1411
  });
1560
- restoreStateIfNeeded();
1412
+ restoreStateIfNeeded$1();
1561
1413
  };
1562
1414
  }
1563
1415
 
@@ -1565,7 +1417,7 @@ function buildSimulators() {
1565
1417
  ReactTestUtils.Simulate = {};
1566
1418
  var eventType;
1567
1419
 
1568
- for (eventType in eventNameDispatchConfigs) {
1420
+ for (eventType in eventNameDispatchConfigs$1) {
1569
1421
  /**
1570
1422
  * @param {!Element|ReactDOMComponent} domComponentOrNode
1571
1423
  * @param {?object} eventData Fake event data to use in SyntheticEvent.
@@ -1617,18 +1469,11 @@ function makeNativeSimulator(eventType, topLevelType) {
1617
1469
  ReactTestUtils.SimulateNative[eventType] = makeNativeSimulator(eventType, topLevelType);
1618
1470
  });
1619
1471
 
1620
-
1621
- var ReactTestUtils$2 = Object.freeze({
1622
- default: ReactTestUtils
1623
- });
1624
-
1625
- var ReactTestUtils$3 = ( ReactTestUtils$2 && ReactTestUtils ) || ReactTestUtils$2;
1626
-
1627
1472
  // TODO: decide on the top-level export form.
1628
1473
  // This is hacky but makes it work with both Rollup and Jest.
1629
1474
 
1630
1475
 
1631
- var testUtils = ReactTestUtils$3.default || ReactTestUtils$3;
1476
+ var testUtils = ReactTestUtils.default || ReactTestUtils;
1632
1477
 
1633
1478
  module.exports = testUtils;
1634
1479
  })();