react 19.0.0-rc.0 → 19.0.0-rc.1

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.
@@ -8,88 +8,17 @@
8
8
  * LICENSE file in the root directory of this source tree.
9
9
  */
10
10
 
11
- 'use strict';
12
-
13
- if (process.env.NODE_ENV !== "production") {
14
- (function() {
15
- 'use strict';
16
-
17
- var React = require('react');
18
-
19
- var ReactSharedInternals = React.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;
20
-
21
- function error(format) {
22
- {
23
- {
24
- for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
25
- args[_key2 - 1] = arguments[_key2];
26
- }
27
-
28
- printWarning('error', format, args);
29
- }
30
- }
31
- } // eslint-disable-next-line react-internal/no-production-logging
32
-
33
- function printWarning(level, format, args) {
34
- // When changing this logic, you might want to also
35
- // update consoleWithStackDev.www.js as well.
36
- {
37
- var isErrorLogger = format === '%s\n\n%s\n' || format === '%o\n\n%s\n\n%s\n';
38
-
39
- if (ReactSharedInternals.getCurrentStack) {
40
- // We only add the current stack to the console when createTask is not supported.
41
- // Since createTask requires DevTools to be open to work, this means that stacks
42
- // can be lost while DevTools isn't open but we can't detect this.
43
- var stack = ReactSharedInternals.getCurrentStack();
44
-
45
- if (stack !== '') {
46
- format += '%s';
47
- args = args.concat([stack]);
48
- }
49
- }
50
-
51
- if (isErrorLogger) {
52
- // Don't prefix our default logging formatting in ReactFiberErrorLoggger.
53
- // Don't toString the arguments.
54
- args.unshift(format);
55
- } else {
56
- // TODO: Remove this prefix and stop toStringing in the wrapper and
57
- // instead do it at each callsite as needed.
58
- // Careful: RN currently depends on this prefix
59
- // eslint-disable-next-line react-internal/safe-string-coercion
60
- args = args.map(function (item) {
61
- return String(item);
62
- });
63
- args.unshift('Warning: ' + format);
64
- } // We intentionally don't use spread (or .apply) directly because it
65
- // breaks IE9: https://github.com/facebook/react/issues/13610
66
- // eslint-disable-next-line react-internal/no-production-logging
67
-
68
-
69
- Function.prototype.apply.call(console[level], console, args);
70
- }
71
- }
72
-
73
- function resolveDispatcher() {
74
- var dispatcher = ReactSharedInternals.H;
75
-
76
- {
77
- if (dispatcher === null) {
78
- error('Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for' + ' one of the following reasons:\n' + '1. You might have mismatching versions of React and the renderer (such as React DOM)\n' + '2. You might be breaking the Rules of Hooks\n' + '3. You might have more than one copy of React in the same app\n' + 'See https://react.dev/link/invalid-hook-call for tips about how to debug and fix this problem.');
79
- }
80
- } // Will result in a null access error if accessed outside render phase. We
81
- // intentionally don't throw our own error because this is in a hot path.
82
- // Also helps ensure this is inlined.
83
-
84
-
85
- return dispatcher;
86
- }
87
- function useMemoCache(size) {
88
- var dispatcher = resolveDispatcher(); // $FlowFixMe[not-a-function] This is unstable, thus optional
89
-
90
- return dispatcher.useMemoCache(size);
91
- }
92
-
93
- exports.c = useMemoCache;
11
+ "use strict";
12
+ "production" !== process.env.NODE_ENV &&
13
+ (function () {
14
+ var ReactSharedInternals =
15
+ require("react").__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;
16
+ exports.c = function (size) {
17
+ var dispatcher = ReactSharedInternals.H;
18
+ null === dispatcher &&
19
+ console.error(
20
+ "Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:\n1. You might have mismatching versions of React and the renderer (such as React DOM)\n2. You might be breaking the Rules of Hooks\n3. You might have more than one copy of React in the same app\nSee https://react.dev/link/invalid-hook-call for tips about how to debug and fix this problem."
21
+ );
22
+ return dispatcher.useMemoCache(size);
23
+ };
94
24
  })();
95
- }