react 0.0.0-experimental-2c169a568 → 0.0.0-experimental-ea6ed3dbb
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.
- package/build-info.json +5 -5
- package/cjs/react.development.js +504 -415
- package/cjs/react.production.min.js +15 -14
- package/package.json +1 -1
- package/umd/react.development.js +514 -421
- package/umd/react.production.min.js +15 -15
- package/umd/react.profiling.min.js +24 -24
package/build-info.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
|
-
"branch": "
|
|
3
|
-
"buildNumber": "
|
|
4
|
-
"checksum": "
|
|
5
|
-
"commit": "
|
|
2
|
+
"branch": "master",
|
|
3
|
+
"buildNumber": "88382",
|
|
4
|
+
"checksum": "1d4644b",
|
|
5
|
+
"commit": "ea6ed3dbb",
|
|
6
6
|
"environment": "ci",
|
|
7
|
-
"reactVersion": "16.12.0-experimental-
|
|
7
|
+
"reactVersion": "16.12.0-experimental-ea6ed3dbb"
|
|
8
8
|
}
|
package/cjs/react.development.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/** @license React v0.0.0-experimental-
|
|
1
|
+
/** @license React v0.0.0-experimental-ea6ed3dbb
|
|
2
2
|
* react.development.js
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
@@ -20,7 +20,7 @@ var checkPropTypes = require('prop-types/checkPropTypes');
|
|
|
20
20
|
|
|
21
21
|
// TODO: this is special because it gets imported during build.
|
|
22
22
|
|
|
23
|
-
var ReactVersion = '16.12.0-experimental-
|
|
23
|
+
var ReactVersion = '16.12.0-experimental-ea6ed3dbb';
|
|
24
24
|
|
|
25
25
|
// The Symbol used to tag the ReactElement-like types. If there is no native Symbol
|
|
26
26
|
// nor polyfill, then a plain number is used for performance.
|
|
@@ -41,6 +41,7 @@ var REACT_SUSPENSE_TYPE = hasSymbol ? Symbol.for('react.suspense') : 0xead1;
|
|
|
41
41
|
var REACT_SUSPENSE_LIST_TYPE = hasSymbol ? Symbol.for('react.suspense_list') : 0xead8;
|
|
42
42
|
var REACT_MEMO_TYPE = hasSymbol ? Symbol.for('react.memo') : 0xead3;
|
|
43
43
|
var REACT_LAZY_TYPE = hasSymbol ? Symbol.for('react.lazy') : 0xead4;
|
|
44
|
+
var REACT_CHUNK_TYPE = hasSymbol ? Symbol.for('react.chunk') : 0xead9;
|
|
44
45
|
var REACT_FUNDAMENTAL_TYPE = hasSymbol ? Symbol.for('react.fundamental') : 0xead5;
|
|
45
46
|
var REACT_RESPONDER_TYPE = hasSymbol ? Symbol.for('react.responder') : 0xead6;
|
|
46
47
|
var REACT_SCOPE_TYPE = hasSymbol ? Symbol.for('react.scope') : 0xead7;
|
|
@@ -60,113 +61,265 @@ function getIteratorFn(maybeIterable) {
|
|
|
60
61
|
return null;
|
|
61
62
|
}
|
|
62
63
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
64
|
+
/**
|
|
65
|
+
* Keeps track of the current dispatcher.
|
|
66
|
+
*/
|
|
67
|
+
var ReactCurrentDispatcher = {
|
|
68
|
+
/**
|
|
69
|
+
* @internal
|
|
70
|
+
* @type {ReactComponent}
|
|
71
|
+
*/
|
|
72
|
+
current: null
|
|
73
|
+
};
|
|
66
74
|
|
|
67
75
|
/**
|
|
68
|
-
*
|
|
69
|
-
*
|
|
70
|
-
* Provide sprintf-style format (only %s is supported) and arguments
|
|
71
|
-
* to provide information about what broke and what you were
|
|
72
|
-
* expecting.
|
|
73
|
-
*
|
|
74
|
-
* The invariant message will be stripped in production, but the invariant
|
|
75
|
-
* will remain to ensure logic does not differ in production.
|
|
76
|
+
* Keeps track of the current batch's configuration such as how long an update
|
|
77
|
+
* should suspend for if it needs to.
|
|
76
78
|
*/
|
|
79
|
+
var ReactCurrentBatchConfig = {
|
|
80
|
+
suspense: null
|
|
81
|
+
};
|
|
77
82
|
|
|
78
83
|
/**
|
|
79
|
-
*
|
|
80
|
-
* https://github.com/facebook/fbjs/blob/e66ba20ad5be433eb54423f2b097d829324d9de6/packages/fbjs/src/__forks__/warning.js
|
|
84
|
+
* Keeps track of the current owner.
|
|
81
85
|
*
|
|
82
|
-
*
|
|
83
|
-
*
|
|
84
|
-
* This really simplifies the code.
|
|
85
|
-
* ---
|
|
86
|
-
* Similar to invariant but only logs a warning if the condition is not met.
|
|
87
|
-
* This can be used to log issues in development environments in critical
|
|
88
|
-
* paths. Removing the logging code for production environments will keep the
|
|
89
|
-
* same logic and follow the same code paths.
|
|
86
|
+
* The current owner is the component who should own any components that are
|
|
87
|
+
* currently being constructed.
|
|
90
88
|
*/
|
|
91
|
-
var
|
|
89
|
+
var ReactCurrentOwner = {
|
|
90
|
+
/**
|
|
91
|
+
* @internal
|
|
92
|
+
* @type {ReactComponent}
|
|
93
|
+
*/
|
|
94
|
+
current: null
|
|
95
|
+
};
|
|
92
96
|
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
+
var BEFORE_SLASH_RE = /^(.*)[\\\/]/;
|
|
98
|
+
var describeComponentFrame = function (name, source, ownerName) {
|
|
99
|
+
var sourceInfo = '';
|
|
100
|
+
|
|
101
|
+
if (source) {
|
|
102
|
+
var path = source.fileName;
|
|
103
|
+
var fileName = path.replace(BEFORE_SLASH_RE, '');
|
|
104
|
+
|
|
105
|
+
{
|
|
106
|
+
// In DEV, include code for a common special case:
|
|
107
|
+
// prefer "folder/index.js" instead of just "index.js".
|
|
108
|
+
if (/^index\./.test(fileName)) {
|
|
109
|
+
var match = path.match(BEFORE_SLASH_RE);
|
|
110
|
+
|
|
111
|
+
if (match) {
|
|
112
|
+
var pathBeforeSlash = match[1];
|
|
113
|
+
|
|
114
|
+
if (pathBeforeSlash) {
|
|
115
|
+
var folderName = pathBeforeSlash.replace(BEFORE_SLASH_RE, '');
|
|
116
|
+
fileName = folderName + '/' + fileName;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
}
|
|
97
120
|
}
|
|
98
121
|
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
122
|
+
sourceInfo = ' (at ' + fileName + ':' + source.lineNumber + ')';
|
|
123
|
+
} else if (ownerName) {
|
|
124
|
+
sourceInfo = ' (created by ' + ownerName + ')';
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
return '\n in ' + (name || 'Unknown') + sourceInfo;
|
|
128
|
+
};
|
|
129
|
+
|
|
130
|
+
var Resolved = 1;
|
|
131
|
+
|
|
132
|
+
function refineResolvedLazyComponent(lazyComponent) {
|
|
133
|
+
return lazyComponent._status === Resolved ? lazyComponent._result : null;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
function getWrappedName(outerType, innerType, wrapperName) {
|
|
137
|
+
var functionName = innerType.displayName || innerType.name || '';
|
|
138
|
+
return outerType.displayName || (functionName !== '' ? wrapperName + "(" + functionName + ")" : wrapperName);
|
|
139
|
+
}
|
|
103
140
|
|
|
104
|
-
|
|
105
|
-
|
|
141
|
+
function getComponentName(type) {
|
|
142
|
+
if (type == null) {
|
|
143
|
+
// Host root, text node or just invalid type.
|
|
144
|
+
return null;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
{
|
|
148
|
+
if (typeof type.tag === 'number') {
|
|
149
|
+
error('Received an unexpected object in getComponentName(). ' + 'This is likely a bug in React. Please file an issue.');
|
|
106
150
|
}
|
|
151
|
+
}
|
|
107
152
|
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
}
|
|
153
|
+
if (typeof type === 'function') {
|
|
154
|
+
return type.displayName || type.name || null;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
if (typeof type === 'string') {
|
|
158
|
+
return type;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
switch (type) {
|
|
162
|
+
case REACT_FRAGMENT_TYPE:
|
|
163
|
+
return 'Fragment';
|
|
164
|
+
|
|
165
|
+
case REACT_PORTAL_TYPE:
|
|
166
|
+
return 'Portal';
|
|
167
|
+
|
|
168
|
+
case REACT_PROFILER_TYPE:
|
|
169
|
+
return "Profiler";
|
|
170
|
+
|
|
171
|
+
case REACT_STRICT_MODE_TYPE:
|
|
172
|
+
return 'StrictMode';
|
|
173
|
+
|
|
174
|
+
case REACT_SUSPENSE_TYPE:
|
|
175
|
+
return 'Suspense';
|
|
176
|
+
|
|
177
|
+
case REACT_SUSPENSE_LIST_TYPE:
|
|
178
|
+
return 'SuspenseList';
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
if (typeof type === 'object') {
|
|
182
|
+
switch (type.$$typeof) {
|
|
183
|
+
case REACT_CONTEXT_TYPE:
|
|
184
|
+
return 'Context.Consumer';
|
|
185
|
+
|
|
186
|
+
case REACT_PROVIDER_TYPE:
|
|
187
|
+
return 'Context.Provider';
|
|
115
188
|
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
189
|
+
case REACT_FORWARD_REF_TYPE:
|
|
190
|
+
return getWrappedName(type, type.render, 'ForwardRef');
|
|
191
|
+
|
|
192
|
+
case REACT_MEMO_TYPE:
|
|
193
|
+
return getComponentName(type.type);
|
|
194
|
+
|
|
195
|
+
case REACT_CHUNK_TYPE:
|
|
196
|
+
return getComponentName(type.render);
|
|
197
|
+
|
|
198
|
+
case REACT_LAZY_TYPE:
|
|
199
|
+
{
|
|
200
|
+
var thenable = type;
|
|
201
|
+
var resolvedThenable = refineResolvedLazyComponent(thenable);
|
|
202
|
+
|
|
203
|
+
if (resolvedThenable) {
|
|
204
|
+
return getComponentName(resolvedThenable);
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
break;
|
|
208
|
+
}
|
|
119
209
|
}
|
|
210
|
+
}
|
|
120
211
|
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
212
|
+
return null;
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
var ReactDebugCurrentFrame = {};
|
|
216
|
+
var currentlyValidatingElement = null;
|
|
217
|
+
function setCurrentlyValidatingElement(element) {
|
|
218
|
+
{
|
|
219
|
+
currentlyValidatingElement = element;
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
{
|
|
224
|
+
// Stack implementation injected by the current renderer.
|
|
225
|
+
ReactDebugCurrentFrame.getCurrentStack = null;
|
|
226
|
+
|
|
227
|
+
ReactDebugCurrentFrame.getStackAddendum = function () {
|
|
228
|
+
var stack = ''; // Add an extra top frame while an element is being validated
|
|
229
|
+
|
|
230
|
+
if (currentlyValidatingElement) {
|
|
231
|
+
var name = getComponentName(currentlyValidatingElement.type);
|
|
232
|
+
var owner = currentlyValidatingElement._owner;
|
|
233
|
+
stack += describeComponentFrame(name, currentlyValidatingElement._source, owner && getComponentName(owner.type));
|
|
234
|
+
} // Delegate to the injected renderer-specific implementation
|
|
125
235
|
|
|
126
|
-
|
|
236
|
+
|
|
237
|
+
var impl = ReactDebugCurrentFrame.getCurrentStack;
|
|
238
|
+
|
|
239
|
+
if (impl) {
|
|
240
|
+
stack += impl() || '';
|
|
127
241
|
}
|
|
242
|
+
|
|
243
|
+
return stack;
|
|
128
244
|
};
|
|
129
245
|
}
|
|
130
246
|
|
|
131
|
-
var lowPriorityWarningWithoutStack$1 = lowPriorityWarningWithoutStack;
|
|
132
|
-
|
|
133
247
|
/**
|
|
134
|
-
*
|
|
135
|
-
* This can be used to log issues in development environments in critical
|
|
136
|
-
* paths. Removing the logging code for production environments will keep the
|
|
137
|
-
* same logic and follow the same code paths.
|
|
248
|
+
* Used by act() to track whether you're inside an act() scope.
|
|
138
249
|
*/
|
|
139
|
-
var
|
|
250
|
+
var IsSomeRendererActing = {
|
|
251
|
+
current: false
|
|
252
|
+
};
|
|
253
|
+
|
|
254
|
+
var ReactSharedInternals = {
|
|
255
|
+
ReactCurrentDispatcher: ReactCurrentDispatcher,
|
|
256
|
+
ReactCurrentBatchConfig: ReactCurrentBatchConfig,
|
|
257
|
+
ReactCurrentOwner: ReactCurrentOwner,
|
|
258
|
+
IsSomeRendererActing: IsSomeRendererActing,
|
|
259
|
+
// Used by renderers to avoid bundling object-assign twice in UMD bundles:
|
|
260
|
+
assign: _assign
|
|
261
|
+
};
|
|
140
262
|
|
|
141
263
|
{
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
264
|
+
_assign(ReactSharedInternals, {
|
|
265
|
+
// These should not be included in production.
|
|
266
|
+
ReactDebugCurrentFrame: ReactDebugCurrentFrame,
|
|
267
|
+
// Shim for React DOM 16.0.0 which still destructured (but not used) this.
|
|
268
|
+
// TODO: remove in React 17.0.
|
|
269
|
+
ReactComponentTreeHook: {}
|
|
270
|
+
});
|
|
271
|
+
}
|
|
146
272
|
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
273
|
+
// by calls to these methods by a Babel plugin.
|
|
274
|
+
//
|
|
275
|
+
// In PROD (or in packages without access to React internals),
|
|
276
|
+
// they are left as they are instead.
|
|
150
277
|
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
278
|
+
function warn(format) {
|
|
279
|
+
{
|
|
280
|
+
for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
281
|
+
args[_key - 1] = arguments[_key];
|
|
154
282
|
}
|
|
155
283
|
|
|
156
|
-
|
|
157
|
-
|
|
284
|
+
printWarning('warn', format, args);
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
function error(format) {
|
|
288
|
+
{
|
|
289
|
+
for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
|
|
290
|
+
args[_key2 - 1] = arguments[_key2];
|
|
158
291
|
}
|
|
159
292
|
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
293
|
+
printWarning('error', format, args);
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
function printWarning(level, format, args) {
|
|
298
|
+
// When changing this logic, you might want to also
|
|
299
|
+
// update consoleWithStackDev.www.js as well.
|
|
300
|
+
{
|
|
301
|
+
var hasExistingStack = args.length > 0 && typeof args[args.length - 1] === 'string' && args[args.length - 1].indexOf('\n in') === 0;
|
|
302
|
+
|
|
303
|
+
if (!hasExistingStack) {
|
|
304
|
+
var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;
|
|
305
|
+
var stack = ReactDebugCurrentFrame.getStackAddendum();
|
|
166
306
|
|
|
167
|
-
|
|
307
|
+
if (stack !== '') {
|
|
308
|
+
format += '%s';
|
|
309
|
+
args = args.concat([stack]);
|
|
310
|
+
}
|
|
168
311
|
}
|
|
169
312
|
|
|
313
|
+
var argsWithFormat = args.map(function (item) {
|
|
314
|
+
return '' + item;
|
|
315
|
+
}); // Careful: RN currently depends on this prefix
|
|
316
|
+
|
|
317
|
+
argsWithFormat.unshift('Warning: ' + format); // We intentionally don't use spread (or .apply) directly because it
|
|
318
|
+
// breaks IE9: https://github.com/facebook/react/issues/13610
|
|
319
|
+
// eslint-disable-next-line react-internal/no-production-logging
|
|
320
|
+
|
|
321
|
+
Function.prototype.apply.call(console[level], console, argsWithFormat);
|
|
322
|
+
|
|
170
323
|
try {
|
|
171
324
|
// --- Welcome to debugging React ---
|
|
172
325
|
// This error was thrown as a convenience so that you can use this stack
|
|
@@ -177,10 +330,23 @@ var warningWithoutStack = function () {};
|
|
|
177
330
|
});
|
|
178
331
|
throw new Error(message);
|
|
179
332
|
} catch (x) {}
|
|
180
|
-
}
|
|
333
|
+
}
|
|
181
334
|
}
|
|
182
335
|
|
|
183
|
-
|
|
336
|
+
// Do not require this module directly! Use normal `invariant` calls with
|
|
337
|
+
// template literal strings. The messages will be replaced with error codes
|
|
338
|
+
// during build.
|
|
339
|
+
|
|
340
|
+
/**
|
|
341
|
+
* Use invariant() to assert state which your program assumes to be true.
|
|
342
|
+
*
|
|
343
|
+
* Provide sprintf-style format (only %s is supported) and arguments
|
|
344
|
+
* to provide information about what broke and what you were
|
|
345
|
+
* expecting.
|
|
346
|
+
*
|
|
347
|
+
* The invariant message will be stripped in production, but the invariant
|
|
348
|
+
* will remain to ensure logic does not differ in production.
|
|
349
|
+
*/
|
|
184
350
|
|
|
185
351
|
var didWarnStateUpdateForUnmountedComponent = {};
|
|
186
352
|
|
|
@@ -194,7 +360,8 @@ function warnNoop(publicInstance, callerName) {
|
|
|
194
360
|
return;
|
|
195
361
|
}
|
|
196
362
|
|
|
197
|
-
|
|
363
|
+
error("Can't call %s on a component that is not yet mounted. " + 'This is a no-op, but it might indicate a bug in your application. ' + 'Instead, assign to `this.state` directly or define a `state = {};` ' + 'class property with the desired state in the %s component.', callerName, componentName);
|
|
364
|
+
|
|
198
365
|
didWarnStateUpdateForUnmountedComponent[warningKey] = true;
|
|
199
366
|
}
|
|
200
367
|
}
|
|
@@ -359,7 +526,8 @@ Component.prototype.forceUpdate = function (callback) {
|
|
|
359
526
|
var defineDeprecationWarning = function (methodName, info) {
|
|
360
527
|
Object.defineProperty(Component.prototype, methodName, {
|
|
361
528
|
get: function () {
|
|
362
|
-
|
|
529
|
+
warn('%s(...) is deprecated in plain JavaScript React classes. %s', info[0], info[1]);
|
|
530
|
+
|
|
363
531
|
return undefined;
|
|
364
532
|
}
|
|
365
533
|
});
|
|
@@ -407,239 +575,99 @@ function createRef() {
|
|
|
407
575
|
return refObject;
|
|
408
576
|
}
|
|
409
577
|
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
*/
|
|
413
|
-
var ReactCurrentDispatcher = {
|
|
414
|
-
/**
|
|
415
|
-
* @internal
|
|
416
|
-
* @type {ReactComponent}
|
|
417
|
-
*/
|
|
418
|
-
current: null
|
|
419
|
-
};
|
|
420
|
-
|
|
421
|
-
/**
|
|
422
|
-
* Keeps track of the current batch's configuration such as how long an update
|
|
423
|
-
* should suspend for if it needs to.
|
|
424
|
-
*/
|
|
425
|
-
var ReactCurrentBatchConfig = {
|
|
426
|
-
suspense: null
|
|
427
|
-
};
|
|
428
|
-
|
|
429
|
-
/**
|
|
430
|
-
* Keeps track of the current owner.
|
|
431
|
-
*
|
|
432
|
-
* The current owner is the component who should own any components that are
|
|
433
|
-
* currently being constructed.
|
|
434
|
-
*/
|
|
435
|
-
var ReactCurrentOwner = {
|
|
436
|
-
/**
|
|
437
|
-
* @internal
|
|
438
|
-
* @type {ReactComponent}
|
|
439
|
-
*/
|
|
440
|
-
current: null
|
|
441
|
-
};
|
|
442
|
-
|
|
443
|
-
var BEFORE_SLASH_RE = /^(.*)[\\\/]/;
|
|
444
|
-
var describeComponentFrame = function (name, source, ownerName) {
|
|
445
|
-
var sourceInfo = '';
|
|
446
|
-
|
|
447
|
-
if (source) {
|
|
448
|
-
var path = source.fileName;
|
|
449
|
-
var fileName = path.replace(BEFORE_SLASH_RE, '');
|
|
450
|
-
|
|
451
|
-
{
|
|
452
|
-
// In DEV, include code for a common special case:
|
|
453
|
-
// prefer "folder/index.js" instead of just "index.js".
|
|
454
|
-
if (/^index\./.test(fileName)) {
|
|
455
|
-
var match = path.match(BEFORE_SLASH_RE);
|
|
456
|
-
|
|
457
|
-
if (match) {
|
|
458
|
-
var pathBeforeSlash = match[1];
|
|
459
|
-
|
|
460
|
-
if (pathBeforeSlash) {
|
|
461
|
-
var folderName = pathBeforeSlash.replace(BEFORE_SLASH_RE, '');
|
|
462
|
-
fileName = folderName + '/' + fileName;
|
|
463
|
-
}
|
|
464
|
-
}
|
|
465
|
-
}
|
|
466
|
-
}
|
|
467
|
-
|
|
468
|
-
sourceInfo = ' (at ' + fileName + ':' + source.lineNumber + ')';
|
|
469
|
-
} else if (ownerName) {
|
|
470
|
-
sourceInfo = ' (created by ' + ownerName + ')';
|
|
471
|
-
}
|
|
472
|
-
|
|
473
|
-
return '\n in ' + (name || 'Unknown') + sourceInfo;
|
|
474
|
-
};
|
|
475
|
-
|
|
476
|
-
var Resolved = 1;
|
|
477
|
-
|
|
478
|
-
function refineResolvedLazyComponent(lazyComponent) {
|
|
479
|
-
return lazyComponent._status === Resolved ? lazyComponent._result : null;
|
|
480
|
-
}
|
|
481
|
-
|
|
482
|
-
function getWrappedName(outerType, innerType, wrapperName) {
|
|
483
|
-
var functionName = innerType.displayName || innerType.name || '';
|
|
484
|
-
return outerType.displayName || (functionName !== '' ? wrapperName + "(" + functionName + ")" : wrapperName);
|
|
485
|
-
}
|
|
578
|
+
// Helps identify side effects in render-phase lifecycle hooks and setState
|
|
579
|
+
// reducers by double invoking them in Strict Mode.
|
|
486
580
|
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
// Host root, text node or just invalid type.
|
|
490
|
-
return null;
|
|
491
|
-
}
|
|
581
|
+
// To preserve the "Pause on caught exceptions" behavior of the debugger, we
|
|
582
|
+
// replay the begin phase of a failed component inside invokeGuardedCallback.
|
|
492
583
|
|
|
493
|
-
|
|
494
|
-
if (typeof type.tag === 'number') {
|
|
495
|
-
warningWithoutStack$1(false, 'Received an unexpected object in getComponentName(). ' + 'This is likely a bug in React. Please file an issue.');
|
|
496
|
-
}
|
|
497
|
-
}
|
|
584
|
+
// Warn about deprecated, async-unsafe lifecycles; relates to RFC #6:
|
|
498
585
|
|
|
499
|
-
|
|
500
|
-
return type.displayName || type.name || null;
|
|
501
|
-
}
|
|
586
|
+
// Gather advanced timing metrics for Profiler subtrees.
|
|
502
587
|
|
|
503
|
-
|
|
504
|
-
return type;
|
|
505
|
-
}
|
|
588
|
+
// Trace which interactions trigger each commit.
|
|
506
589
|
|
|
507
|
-
|
|
508
|
-
case REACT_FRAGMENT_TYPE:
|
|
509
|
-
return 'Fragment';
|
|
590
|
+
// SSR experiments
|
|
510
591
|
|
|
511
|
-
case REACT_PORTAL_TYPE:
|
|
512
|
-
return 'Portal';
|
|
513
592
|
|
|
514
|
-
|
|
515
|
-
return "Profiler";
|
|
593
|
+
// Flight experiments
|
|
516
594
|
|
|
517
|
-
|
|
518
|
-
return 'StrictMode';
|
|
595
|
+
var enableChunksAPI = true; // Only used in www builds.
|
|
519
596
|
|
|
520
|
-
|
|
521
|
-
return 'Suspense';
|
|
597
|
+
// Only used in www builds.
|
|
522
598
|
|
|
523
|
-
|
|
524
|
-
return 'SuspenseList';
|
|
525
|
-
}
|
|
599
|
+
// Disable javascript: URL strings in href for XSS protection.
|
|
526
600
|
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
case REACT_CONTEXT_TYPE:
|
|
530
|
-
return 'Context.Consumer';
|
|
601
|
+
// These APIs will no longer be "unstable" in the upcoming 16.7 release,
|
|
602
|
+
// Control this behavior with a flag to support 16.6 minor releases in the meanwhile.
|
|
531
603
|
|
|
532
|
-
|
|
533
|
-
|
|
604
|
+
var exposeConcurrentModeAPIs = true;
|
|
605
|
+
// Experimental React Flare event system and event components support.
|
|
534
606
|
|
|
535
|
-
|
|
536
|
-
return getWrappedName(type, type.render, 'ForwardRef');
|
|
607
|
+
var enableDeprecatedFlareAPI = false; // Experimental Host Component support.
|
|
537
608
|
|
|
538
|
-
|
|
539
|
-
return getComponentName(type.type);
|
|
609
|
+
var enableFundamentalAPI = false; // Experimental Scope support.
|
|
540
610
|
|
|
541
|
-
|
|
542
|
-
{
|
|
543
|
-
var thenable = type;
|
|
544
|
-
var resolvedThenable = refineResolvedLazyComponent(thenable);
|
|
611
|
+
var enableScopeAPI = false; // New API for JSX transforms to target - https://github.com/reactjs/rfcs/pull/107
|
|
545
612
|
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
}
|
|
613
|
+
var enableJSXTransformAPI = false; // We will enforce mocking scheduler with scheduler/unstable_mock at some point. (v17?)
|
|
614
|
+
// Till then, we warn about the missing mock, but still fallback to a legacy mode compatible version
|
|
549
615
|
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
}
|
|
553
|
-
}
|
|
616
|
+
// For tests, we flush suspense fallbacks in an act scope;
|
|
617
|
+
// *except* in some of our own tests, where we test incremental loading states.
|
|
554
618
|
|
|
555
|
-
|
|
556
|
-
|
|
619
|
+
// Add a callback property to suspense to notify which promises are currently
|
|
620
|
+
// in the update queue. This allows reporting and tracing of what is causing
|
|
621
|
+
// the user to see a loading state.
|
|
622
|
+
// Also allows hydration callbacks to fire when a dehydrated boundary gets
|
|
623
|
+
// hydrated or deleted.
|
|
557
624
|
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
{
|
|
562
|
-
currentlyValidatingElement = element;
|
|
563
|
-
}
|
|
564
|
-
}
|
|
625
|
+
// Part of the simplification of React.createElement so we can eventually move
|
|
626
|
+
// from React.createElement to React.jsx
|
|
627
|
+
// https://github.com/reactjs/rfcs/blob/createlement-rfc/text/0000-create-element-changes.md
|
|
565
628
|
|
|
566
|
-
{
|
|
567
|
-
// Stack implementation injected by the current renderer.
|
|
568
|
-
ReactDebugCurrentFrame.getCurrentStack = null;
|
|
569
629
|
|
|
570
|
-
ReactDebugCurrentFrame.getStackAddendum = function () {
|
|
571
|
-
var stack = ''; // Add an extra top frame while an element is being validated
|
|
572
630
|
|
|
573
|
-
if (currentlyValidatingElement) {
|
|
574
|
-
var name = getComponentName(currentlyValidatingElement.type);
|
|
575
|
-
var owner = currentlyValidatingElement._owner;
|
|
576
|
-
stack += describeComponentFrame(name, currentlyValidatingElement._source, owner && getComponentName(owner.type));
|
|
577
|
-
} // Delegate to the injected renderer-specific implementation
|
|
578
631
|
|
|
632
|
+
// Flag to turn event.target and event.currentTarget in ReactNative from a reactTag to a component instance
|
|
579
633
|
|
|
580
|
-
|
|
634
|
+
// Controls sequence of passive effect destroy and create functions.
|
|
635
|
+
// If this flag is off, destroy and create functions may be interleaved.
|
|
636
|
+
// When the falg is on, all destroy functions will be run (for all fibers)
|
|
637
|
+
// before any create functions are run, similar to how layout effects work.
|
|
638
|
+
// This flag provides a killswitch if that proves to break existing code somehow.
|
|
581
639
|
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
640
|
+
// Controls behavior of deferred effect destroy functions during unmount.
|
|
641
|
+
// Previously these functions were run during commit (along with layout effects).
|
|
642
|
+
// Ideally we should delay these until after commit for performance reasons.
|
|
643
|
+
// This flag provides a killswitch if that proves to break existing code somehow.
|
|
644
|
+
//
|
|
645
|
+
// WARNING This flag only has an affect if used with runAllPassiveEffectDestroysBeforeCreates.
|
|
585
646
|
|
|
586
|
-
return stack;
|
|
587
|
-
};
|
|
588
|
-
}
|
|
589
647
|
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
};
|
|
648
|
+
// --------------------------
|
|
649
|
+
// Future APIs to be deprecated
|
|
650
|
+
// --------------------------
|
|
651
|
+
// Prevent the value and checked attributes from syncing
|
|
652
|
+
// with their related DOM properties
|
|
596
653
|
|
|
597
|
-
var ReactSharedInternals = {
|
|
598
|
-
ReactCurrentDispatcher: ReactCurrentDispatcher,
|
|
599
|
-
ReactCurrentBatchConfig: ReactCurrentBatchConfig,
|
|
600
|
-
ReactCurrentOwner: ReactCurrentOwner,
|
|
601
|
-
IsSomeRendererActing: IsSomeRendererActing,
|
|
602
|
-
// Used by renderers to avoid bundling object-assign twice in UMD bundles:
|
|
603
|
-
assign: _assign
|
|
604
|
-
};
|
|
605
654
|
|
|
606
|
-
{
|
|
607
|
-
_assign(ReactSharedInternals, {
|
|
608
|
-
// These should not be included in production.
|
|
609
|
-
ReactDebugCurrentFrame: ReactDebugCurrentFrame,
|
|
610
|
-
// Shim for React DOM 16.0.0 which still destructured (but not used) this.
|
|
611
|
-
// TODO: remove in React 17.0.
|
|
612
|
-
ReactComponentTreeHook: {}
|
|
613
|
-
});
|
|
614
|
-
}
|
|
615
655
|
|
|
616
|
-
|
|
617
|
-
* Similar to invariant but only logs a warning if the condition is not met.
|
|
618
|
-
* This can be used to log issues in development environments in critical
|
|
619
|
-
* paths. Removing the logging code for production environments will keep the
|
|
620
|
-
* same logic and follow the same code paths.
|
|
621
|
-
*/
|
|
656
|
+
// Disables React.createFactory
|
|
622
657
|
|
|
623
|
-
var
|
|
658
|
+
var disableCreateFactory = false; // Disables hydrate, render, findDOMNode, unmountComponentAtNode
|
|
624
659
|
|
|
625
|
-
|
|
626
|
-
warning = function (condition, format) {
|
|
627
|
-
if (condition) {
|
|
628
|
-
return;
|
|
629
|
-
}
|
|
660
|
+
// Disables children for <textarea> elements
|
|
630
661
|
|
|
631
|
-
|
|
632
|
-
var stack = ReactDebugCurrentFrame.getStackAddendum(); // eslint-disable-next-line react-internal/warning-and-invariant-args
|
|
662
|
+
// Disables Maps as ReactElement children
|
|
633
663
|
|
|
634
|
-
|
|
635
|
-
args[_key - 2] = arguments[_key];
|
|
636
|
-
}
|
|
664
|
+
var disableMapsAsChildren = false; // Disables ReactDOM.unstable_renderSubtreeIntoContainer
|
|
637
665
|
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
666
|
+
// We should remove this flag once the above flag becomes enabled
|
|
667
|
+
|
|
668
|
+
// Disables ReactDOM.unstable_createPortal
|
|
641
669
|
|
|
642
|
-
|
|
670
|
+
// Modern event system where events get registered at roots
|
|
643
671
|
|
|
644
672
|
var hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
645
673
|
var RESERVED_PROPS = {
|
|
@@ -650,6 +678,11 @@ var RESERVED_PROPS = {
|
|
|
650
678
|
};
|
|
651
679
|
var specialPropKeyWarningShown;
|
|
652
680
|
var specialPropRefWarningShown;
|
|
681
|
+
var didWarnAboutStringRefs;
|
|
682
|
+
|
|
683
|
+
{
|
|
684
|
+
didWarnAboutStringRefs = {};
|
|
685
|
+
}
|
|
653
686
|
|
|
654
687
|
function hasValidRef(config) {
|
|
655
688
|
{
|
|
@@ -681,9 +714,12 @@ function hasValidKey(config) {
|
|
|
681
714
|
|
|
682
715
|
function defineKeyPropWarningGetter(props, displayName) {
|
|
683
716
|
var warnAboutAccessingKey = function () {
|
|
684
|
-
|
|
685
|
-
specialPropKeyWarningShown
|
|
686
|
-
|
|
717
|
+
{
|
|
718
|
+
if (!specialPropKeyWarningShown) {
|
|
719
|
+
specialPropKeyWarningShown = true;
|
|
720
|
+
|
|
721
|
+
error('%s: `key` is not a prop. Trying to access it will result ' + 'in `undefined` being returned. If you need to access the same ' + 'value within the child component, you should pass it as a different ' + 'prop. (https://fb.me/react-special-props)', displayName);
|
|
722
|
+
}
|
|
687
723
|
}
|
|
688
724
|
};
|
|
689
725
|
|
|
@@ -696,9 +732,12 @@ function defineKeyPropWarningGetter(props, displayName) {
|
|
|
696
732
|
|
|
697
733
|
function defineRefPropWarningGetter(props, displayName) {
|
|
698
734
|
var warnAboutAccessingRef = function () {
|
|
699
|
-
|
|
700
|
-
specialPropRefWarningShown
|
|
701
|
-
|
|
735
|
+
{
|
|
736
|
+
if (!specialPropRefWarningShown) {
|
|
737
|
+
specialPropRefWarningShown = true;
|
|
738
|
+
|
|
739
|
+
error('%s: `ref` is not a prop. Trying to access it will result ' + 'in `undefined` being returned. If you need to access the same ' + 'value within the child component, you should pass it as a different ' + 'prop. (https://fb.me/react-special-props)', displayName);
|
|
740
|
+
}
|
|
702
741
|
}
|
|
703
742
|
};
|
|
704
743
|
|
|
@@ -708,6 +747,20 @@ function defineRefPropWarningGetter(props, displayName) {
|
|
|
708
747
|
configurable: true
|
|
709
748
|
});
|
|
710
749
|
}
|
|
750
|
+
|
|
751
|
+
function warnIfStringRefCannotBeAutoConverted(config) {
|
|
752
|
+
{
|
|
753
|
+
if (typeof config.ref === 'string' && ReactCurrentOwner.current && config.__self && ReactCurrentOwner.current.stateNode !== config.__self) {
|
|
754
|
+
var componentName = getComponentName(ReactCurrentOwner.current.type);
|
|
755
|
+
|
|
756
|
+
if (!didWarnAboutStringRefs[componentName]) {
|
|
757
|
+
error('Component "%s" contains the string ref "%s". ' + 'Support for string refs will be removed in a future major release. ' + 'This case cannot be automatically converted to an arrow function. ' + 'We ask you to manually fix this case by using useRef() or createRef() instead. ' + 'Learn more about using refs safely here: ' + 'https://fb.me/react-strict-mode-string-ref', getComponentName(ReactCurrentOwner.current.type), config.ref);
|
|
758
|
+
|
|
759
|
+
didWarnAboutStringRefs[componentName] = true;
|
|
760
|
+
}
|
|
761
|
+
}
|
|
762
|
+
}
|
|
763
|
+
}
|
|
711
764
|
/**
|
|
712
765
|
* Factory method to create a new React element. This no longer adheres to
|
|
713
766
|
* the class pattern, so do not use new to call it. Also, instanceof check
|
|
@@ -821,6 +874,7 @@ function jsxDEV(type, config, maybeKey, source, self) {
|
|
|
821
874
|
|
|
822
875
|
if (hasValidRef(config)) {
|
|
823
876
|
ref = config.ref;
|
|
877
|
+
warnIfStringRefCannotBeAutoConverted(config);
|
|
824
878
|
} // Remaining properties are added to a new props object
|
|
825
879
|
|
|
826
880
|
|
|
@@ -872,6 +926,10 @@ function createElement(type, config, children) {
|
|
|
872
926
|
if (config != null) {
|
|
873
927
|
if (hasValidRef(config)) {
|
|
874
928
|
ref = config.ref;
|
|
929
|
+
|
|
930
|
+
{
|
|
931
|
+
warnIfStringRefCannotBeAutoConverted(config);
|
|
932
|
+
}
|
|
875
933
|
}
|
|
876
934
|
|
|
877
935
|
if (hasValidKey(config)) {
|
|
@@ -1164,10 +1222,21 @@ function traverseAllChildrenImpl(children, nameSoFar, callback, traverseContext)
|
|
|
1164
1222
|
var iteratorFn = getIteratorFn(children);
|
|
1165
1223
|
|
|
1166
1224
|
if (typeof iteratorFn === 'function') {
|
|
1225
|
+
if (disableMapsAsChildren) {
|
|
1226
|
+
if (!(iteratorFn !== children.entries)) {
|
|
1227
|
+
{
|
|
1228
|
+
throw Error("Maps are not valid as a React child (found: " + children + "). Consider converting children to an array of keyed ReactElements instead.");
|
|
1229
|
+
}
|
|
1230
|
+
}
|
|
1231
|
+
}
|
|
1232
|
+
|
|
1167
1233
|
{
|
|
1168
1234
|
// Warn about using Maps as children
|
|
1169
1235
|
if (iteratorFn === children.entries) {
|
|
1170
|
-
!didWarnAboutMaps
|
|
1236
|
+
if (!didWarnAboutMaps) {
|
|
1237
|
+
warn('Using Maps as children is deprecated and will be removed in ' + 'a future major release. Consider converting children to ' + 'an array of keyed ReactElements instead.');
|
|
1238
|
+
}
|
|
1239
|
+
|
|
1171
1240
|
didWarnAboutMaps = true;
|
|
1172
1241
|
}
|
|
1173
1242
|
}
|
|
@@ -1394,7 +1463,9 @@ function createContext(defaultValue, calculateChangedBits) {
|
|
|
1394
1463
|
calculateChangedBits = null;
|
|
1395
1464
|
} else {
|
|
1396
1465
|
{
|
|
1397
|
-
|
|
1466
|
+
if (calculateChangedBits !== null && typeof calculateChangedBits !== 'function') {
|
|
1467
|
+
error('createContext: Expected the optional second argument to be a ' + 'function. Instead received: %s', calculateChangedBits);
|
|
1468
|
+
}
|
|
1398
1469
|
}
|
|
1399
1470
|
}
|
|
1400
1471
|
|
|
@@ -1437,7 +1508,8 @@ function createContext(defaultValue, calculateChangedBits) {
|
|
|
1437
1508
|
get: function () {
|
|
1438
1509
|
if (!hasWarnedAboutUsingConsumerProvider) {
|
|
1439
1510
|
hasWarnedAboutUsingConsumerProvider = true;
|
|
1440
|
-
|
|
1511
|
+
|
|
1512
|
+
error('Rendering <Context.Consumer.Provider> is not supported and will be removed in ' + 'a future major release. Did you mean to render <Context.Provider> instead?');
|
|
1441
1513
|
}
|
|
1442
1514
|
|
|
1443
1515
|
return context.Provider;
|
|
@@ -1474,7 +1546,8 @@ function createContext(defaultValue, calculateChangedBits) {
|
|
|
1474
1546
|
get: function () {
|
|
1475
1547
|
if (!hasWarnedAboutUsingNestedContextConsumers) {
|
|
1476
1548
|
hasWarnedAboutUsingNestedContextConsumers = true;
|
|
1477
|
-
|
|
1549
|
+
|
|
1550
|
+
error('Rendering <Context.Consumer.Consumer> is not supported and will be removed in ' + 'a future major release. Did you mean to render <Context.Consumer> instead?');
|
|
1478
1551
|
}
|
|
1479
1552
|
|
|
1480
1553
|
return context.Consumer;
|
|
@@ -1513,7 +1586,8 @@ function lazy(ctor) {
|
|
|
1513
1586
|
return defaultProps;
|
|
1514
1587
|
},
|
|
1515
1588
|
set: function (newDefaultProps) {
|
|
1516
|
-
|
|
1589
|
+
error('React.lazy(...): It is not supported to assign `defaultProps` to ' + 'a lazy component import. Either specify them where the component ' + 'is defined, or create a wrapping component around it.');
|
|
1590
|
+
|
|
1517
1591
|
defaultProps = newDefaultProps; // Match production behavior more closely:
|
|
1518
1592
|
|
|
1519
1593
|
Object.defineProperty(lazyType, 'defaultProps', {
|
|
@@ -1527,7 +1601,8 @@ function lazy(ctor) {
|
|
|
1527
1601
|
return propTypes;
|
|
1528
1602
|
},
|
|
1529
1603
|
set: function (newPropTypes) {
|
|
1530
|
-
|
|
1604
|
+
error('React.lazy(...): It is not supported to assign `propTypes` to ' + 'a lazy component import. Either specify them where the component ' + 'is defined, or create a wrapping component around it.');
|
|
1605
|
+
|
|
1531
1606
|
propTypes = newPropTypes; // Match production behavior more closely:
|
|
1532
1607
|
|
|
1533
1608
|
Object.defineProperty(lazyType, 'propTypes', {
|
|
@@ -1544,16 +1619,19 @@ function lazy(ctor) {
|
|
|
1544
1619
|
function forwardRef(render) {
|
|
1545
1620
|
{
|
|
1546
1621
|
if (render != null && render.$$typeof === REACT_MEMO_TYPE) {
|
|
1547
|
-
|
|
1622
|
+
error('forwardRef requires a render function but received a `memo` ' + 'component. Instead of forwardRef(memo(...)), use ' + 'memo(forwardRef(...)).');
|
|
1548
1623
|
} else if (typeof render !== 'function') {
|
|
1549
|
-
|
|
1624
|
+
error('forwardRef requires a render function but was given %s.', render === null ? 'null' : typeof render);
|
|
1550
1625
|
} else {
|
|
1551
|
-
|
|
1552
|
-
|
|
1626
|
+
if (render.length !== 0 && render.length !== 2) {
|
|
1627
|
+
error('forwardRef render functions accept exactly two parameters: props and ref. %s', render.length === 1 ? 'Did you forget to use the ref parameter?' : 'Any additional parameter will be undefined.');
|
|
1628
|
+
}
|
|
1553
1629
|
}
|
|
1554
1630
|
|
|
1555
1631
|
if (render != null) {
|
|
1556
|
-
|
|
1632
|
+
if (render.defaultProps != null || render.propTypes != null) {
|
|
1633
|
+
error('forwardRef render functions do not support propTypes or defaultProps. ' + 'Did you accidentally pass a React component?');
|
|
1634
|
+
}
|
|
1557
1635
|
}
|
|
1558
1636
|
}
|
|
1559
1637
|
|
|
@@ -1565,13 +1643,13 @@ function forwardRef(render) {
|
|
|
1565
1643
|
|
|
1566
1644
|
function isValidElementType(type) {
|
|
1567
1645
|
return typeof type === 'string' || typeof type === 'function' || // Note: its typeof might be other than 'symbol' or 'number' if it's a polyfill.
|
|
1568
|
-
type === REACT_FRAGMENT_TYPE || type === REACT_CONCURRENT_MODE_TYPE || type === REACT_PROFILER_TYPE || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || type === REACT_SUSPENSE_LIST_TYPE || typeof type === 'object' && type !== null && (type.$$typeof === REACT_LAZY_TYPE || type.$$typeof === REACT_MEMO_TYPE || type.$$typeof === REACT_PROVIDER_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE || type.$$typeof === REACT_FUNDAMENTAL_TYPE || type.$$typeof === REACT_RESPONDER_TYPE || type.$$typeof === REACT_SCOPE_TYPE);
|
|
1646
|
+
type === REACT_FRAGMENT_TYPE || type === REACT_CONCURRENT_MODE_TYPE || type === REACT_PROFILER_TYPE || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || type === REACT_SUSPENSE_LIST_TYPE || typeof type === 'object' && type !== null && (type.$$typeof === REACT_LAZY_TYPE || type.$$typeof === REACT_MEMO_TYPE || type.$$typeof === REACT_PROVIDER_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE || type.$$typeof === REACT_FUNDAMENTAL_TYPE || type.$$typeof === REACT_RESPONDER_TYPE || type.$$typeof === REACT_SCOPE_TYPE || type.$$typeof === REACT_CHUNK_TYPE);
|
|
1569
1647
|
}
|
|
1570
1648
|
|
|
1571
1649
|
function memo(type, compare) {
|
|
1572
1650
|
{
|
|
1573
1651
|
if (!isValidElementType(type)) {
|
|
1574
|
-
|
|
1652
|
+
error('memo: The first argument must be a component. Instead ' + 'received: %s', type === null ? 'null' : typeof type);
|
|
1575
1653
|
}
|
|
1576
1654
|
}
|
|
1577
1655
|
|
|
@@ -1582,6 +1660,41 @@ function memo(type, compare) {
|
|
|
1582
1660
|
};
|
|
1583
1661
|
}
|
|
1584
1662
|
|
|
1663
|
+
function chunk(query, render) {
|
|
1664
|
+
{
|
|
1665
|
+
if (typeof query !== 'function') {
|
|
1666
|
+
error('Chunks require a query function but was given %s.', query === null ? 'null' : typeof query);
|
|
1667
|
+
}
|
|
1668
|
+
|
|
1669
|
+
if (render != null && render.$$typeof === REACT_MEMO_TYPE) {
|
|
1670
|
+
error('Chunks require a render function but received a `memo` ' + 'component. Use `memo` on an inner component instead.');
|
|
1671
|
+
} else if (render != null && render.$$typeof === REACT_FORWARD_REF_TYPE) {
|
|
1672
|
+
error('Chunks require a render function but received a `forwardRef` ' + 'component. Use `forwardRef` on an inner component instead.');
|
|
1673
|
+
} else if (typeof render !== 'function') {
|
|
1674
|
+
error('Chunks require a render function but was given %s.', render === null ? 'null' : typeof render);
|
|
1675
|
+
} else if (render.length !== 0 && render.length !== 2) {
|
|
1676
|
+
// Warn if it's not accepting two args.
|
|
1677
|
+
// Do not warn for 0 arguments because it could be due to usage of the 'arguments' object
|
|
1678
|
+
error('Chunk render functions accept exactly two parameters: props and data. %s', render.length === 1 ? 'Did you forget to use the data parameter?' : 'Any additional parameter will be undefined.');
|
|
1679
|
+
}
|
|
1680
|
+
|
|
1681
|
+
if (render != null && (render.defaultProps != null || render.propTypes != null)) {
|
|
1682
|
+
error('Chunk render functions do not support propTypes or defaultProps. ' + 'Did you accidentally pass a React component?');
|
|
1683
|
+
}
|
|
1684
|
+
}
|
|
1685
|
+
|
|
1686
|
+
return function () {
|
|
1687
|
+
var args = arguments;
|
|
1688
|
+
return {
|
|
1689
|
+
$$typeof: REACT_CHUNK_TYPE,
|
|
1690
|
+
query: function () {
|
|
1691
|
+
return query.apply(null, args);
|
|
1692
|
+
},
|
|
1693
|
+
render: render
|
|
1694
|
+
};
|
|
1695
|
+
};
|
|
1696
|
+
}
|
|
1697
|
+
|
|
1585
1698
|
function resolveDispatcher() {
|
|
1586
1699
|
var dispatcher = ReactCurrentDispatcher.current;
|
|
1587
1700
|
|
|
@@ -1598,16 +1711,19 @@ function useContext(Context, unstable_observedBits) {
|
|
|
1598
1711
|
var dispatcher = resolveDispatcher();
|
|
1599
1712
|
|
|
1600
1713
|
{
|
|
1601
|
-
|
|
1714
|
+
if (unstable_observedBits !== undefined) {
|
|
1715
|
+
error('useContext() second argument is reserved for future ' + 'use in React. Passing it is not supported. ' + 'You passed: %s.%s', unstable_observedBits, typeof unstable_observedBits === 'number' && Array.isArray(arguments[2]) ? '\n\nDid you call array.map(useContext)? ' + 'Calling Hooks inside a loop is not supported. ' + 'Learn more at https://fb.me/rules-of-hooks' : '');
|
|
1716
|
+
} // TODO: add a more generic warning for invalid values.
|
|
1717
|
+
|
|
1602
1718
|
|
|
1603
1719
|
if (Context._context !== undefined) {
|
|
1604
1720
|
var realContext = Context._context; // Don't deduplicate because this legitimately causes bugs
|
|
1605
1721
|
// and nobody should be using this in existing code.
|
|
1606
1722
|
|
|
1607
1723
|
if (realContext.Consumer === Context) {
|
|
1608
|
-
|
|
1724
|
+
error('Calling useContext(Context.Consumer) is not supported, may cause bugs, and will be ' + 'removed in a future major release. Did you mean to call useContext(Context) instead?');
|
|
1609
1725
|
} else if (realContext.Provider === Context) {
|
|
1610
|
-
|
|
1726
|
+
error('Calling useContext(Context.Provider) is not supported. ' + 'Did you mean to call useContext(Context) instead?');
|
|
1611
1727
|
}
|
|
1612
1728
|
}
|
|
1613
1729
|
}
|
|
@@ -1626,25 +1742,25 @@ function useRef(initialValue) {
|
|
|
1626
1742
|
var dispatcher = resolveDispatcher();
|
|
1627
1743
|
return dispatcher.useRef(initialValue);
|
|
1628
1744
|
}
|
|
1629
|
-
function useEffect(create,
|
|
1745
|
+
function useEffect(create, deps) {
|
|
1630
1746
|
var dispatcher = resolveDispatcher();
|
|
1631
|
-
return dispatcher.useEffect(create,
|
|
1747
|
+
return dispatcher.useEffect(create, deps);
|
|
1632
1748
|
}
|
|
1633
|
-
function useLayoutEffect(create,
|
|
1749
|
+
function useLayoutEffect(create, deps) {
|
|
1634
1750
|
var dispatcher = resolveDispatcher();
|
|
1635
|
-
return dispatcher.useLayoutEffect(create,
|
|
1751
|
+
return dispatcher.useLayoutEffect(create, deps);
|
|
1636
1752
|
}
|
|
1637
|
-
function useCallback(callback,
|
|
1753
|
+
function useCallback(callback, deps) {
|
|
1638
1754
|
var dispatcher = resolveDispatcher();
|
|
1639
|
-
return dispatcher.useCallback(callback,
|
|
1755
|
+
return dispatcher.useCallback(callback, deps);
|
|
1640
1756
|
}
|
|
1641
|
-
function useMemo(create,
|
|
1757
|
+
function useMemo(create, deps) {
|
|
1642
1758
|
var dispatcher = resolveDispatcher();
|
|
1643
|
-
return dispatcher.useMemo(create,
|
|
1759
|
+
return dispatcher.useMemo(create, deps);
|
|
1644
1760
|
}
|
|
1645
|
-
function useImperativeHandle(ref, create,
|
|
1761
|
+
function useImperativeHandle(ref, create, deps) {
|
|
1646
1762
|
var dispatcher = resolveDispatcher();
|
|
1647
|
-
return dispatcher.useImperativeHandle(ref, create,
|
|
1763
|
+
return dispatcher.useImperativeHandle(ref, create, deps);
|
|
1648
1764
|
}
|
|
1649
1765
|
function useDebugValue(value, formatterFn) {
|
|
1650
1766
|
{
|
|
@@ -1658,7 +1774,8 @@ function useResponder(responder, listenerProps) {
|
|
|
1658
1774
|
|
|
1659
1775
|
{
|
|
1660
1776
|
if (responder == null || responder.$$typeof !== REACT_RESPONDER_TYPE) {
|
|
1661
|
-
|
|
1777
|
+
error('useResponder: invalid first argument. Expected an event responder, but instead got %s', responder);
|
|
1778
|
+
|
|
1662
1779
|
return;
|
|
1663
1780
|
}
|
|
1664
1781
|
}
|
|
@@ -1789,7 +1906,7 @@ function validateExplicitKey(element, parentType) {
|
|
|
1789
1906
|
setCurrentlyValidatingElement(element);
|
|
1790
1907
|
|
|
1791
1908
|
{
|
|
1792
|
-
|
|
1909
|
+
error('Each child in a list should have a unique "key" prop.' + '%s%s See https://fb.me/react-warning-keys for more information.', currentComponentErrorInfo, childOwner);
|
|
1793
1910
|
}
|
|
1794
1911
|
|
|
1795
1912
|
setCurrentlyValidatingElement(null);
|
|
@@ -1851,36 +1968,39 @@ function validateChildKeys(node, parentType) {
|
|
|
1851
1968
|
|
|
1852
1969
|
|
|
1853
1970
|
function validatePropTypes(element) {
|
|
1854
|
-
|
|
1971
|
+
{
|
|
1972
|
+
var type = element.type;
|
|
1855
1973
|
|
|
1856
|
-
|
|
1857
|
-
|
|
1858
|
-
|
|
1974
|
+
if (type === null || type === undefined || typeof type === 'string') {
|
|
1975
|
+
return;
|
|
1976
|
+
}
|
|
1859
1977
|
|
|
1860
|
-
|
|
1861
|
-
|
|
1978
|
+
var name = getComponentName(type);
|
|
1979
|
+
var propTypes;
|
|
1862
1980
|
|
|
1863
|
-
|
|
1864
|
-
|
|
1865
|
-
|
|
1866
|
-
|
|
1867
|
-
|
|
1868
|
-
|
|
1869
|
-
|
|
1870
|
-
|
|
1871
|
-
|
|
1981
|
+
if (typeof type === 'function') {
|
|
1982
|
+
propTypes = type.propTypes;
|
|
1983
|
+
} else if (typeof type === 'object' && (type.$$typeof === REACT_FORWARD_REF_TYPE || // Note: Memo only checks outer props here.
|
|
1984
|
+
// Inner props are checked in the reconciler.
|
|
1985
|
+
type.$$typeof === REACT_MEMO_TYPE)) {
|
|
1986
|
+
propTypes = type.propTypes;
|
|
1987
|
+
} else {
|
|
1988
|
+
return;
|
|
1989
|
+
}
|
|
1872
1990
|
|
|
1873
|
-
|
|
1874
|
-
|
|
1875
|
-
|
|
1876
|
-
|
|
1877
|
-
|
|
1878
|
-
|
|
1879
|
-
warningWithoutStack$1(false, 'Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?', name || 'Unknown');
|
|
1880
|
-
}
|
|
1991
|
+
if (propTypes) {
|
|
1992
|
+
setCurrentlyValidatingElement(element);
|
|
1993
|
+
checkPropTypes(propTypes, element.props, 'prop', name, ReactDebugCurrentFrame.getStackAddendum);
|
|
1994
|
+
setCurrentlyValidatingElement(null);
|
|
1995
|
+
} else if (type.PropTypes !== undefined && !propTypesMisspellWarningShown) {
|
|
1996
|
+
propTypesMisspellWarningShown = true;
|
|
1881
1997
|
|
|
1882
|
-
|
|
1883
|
-
|
|
1998
|
+
error('Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?', name || 'Unknown');
|
|
1999
|
+
}
|
|
2000
|
+
|
|
2001
|
+
if (typeof type.getDefaultProps === 'function' && !type.getDefaultProps.isReactClassApproved) {
|
|
2002
|
+
error('getDefaultProps is only used on classic React.createClass ' + 'definitions. Use a static property named `defaultProps` instead.');
|
|
2003
|
+
}
|
|
1884
2004
|
}
|
|
1885
2005
|
}
|
|
1886
2006
|
/**
|
|
@@ -1890,23 +2010,26 @@ function validatePropTypes(element) {
|
|
|
1890
2010
|
|
|
1891
2011
|
|
|
1892
2012
|
function validateFragmentProps(fragment) {
|
|
1893
|
-
|
|
1894
|
-
|
|
2013
|
+
{
|
|
2014
|
+
setCurrentlyValidatingElement(fragment);
|
|
2015
|
+
var keys = Object.keys(fragment.props);
|
|
1895
2016
|
|
|
1896
|
-
|
|
1897
|
-
|
|
2017
|
+
for (var i = 0; i < keys.length; i++) {
|
|
2018
|
+
var key = keys[i];
|
|
1898
2019
|
|
|
1899
|
-
|
|
1900
|
-
|
|
1901
|
-
|
|
2020
|
+
if (key !== 'children' && key !== 'key') {
|
|
2021
|
+
error('Invalid prop `%s` supplied to `React.Fragment`. ' + 'React.Fragment can only have `key` and `children` props.', key);
|
|
2022
|
+
|
|
2023
|
+
break;
|
|
2024
|
+
}
|
|
1902
2025
|
}
|
|
1903
|
-
}
|
|
1904
2026
|
|
|
1905
|
-
|
|
1906
|
-
|
|
1907
|
-
|
|
2027
|
+
if (fragment.ref !== null) {
|
|
2028
|
+
error('Invalid attribute `ref` supplied to `React.Fragment`.');
|
|
2029
|
+
}
|
|
1908
2030
|
|
|
1909
|
-
|
|
2031
|
+
setCurrentlyValidatingElement(null);
|
|
2032
|
+
}
|
|
1910
2033
|
}
|
|
1911
2034
|
|
|
1912
2035
|
function jsxWithValidation(type, props, key, isStaticChildren, source, self) {
|
|
@@ -1941,7 +2064,9 @@ function jsxWithValidation(type, props, key, isStaticChildren, source, self) {
|
|
|
1941
2064
|
typeString = typeof type;
|
|
1942
2065
|
}
|
|
1943
2066
|
|
|
1944
|
-
|
|
2067
|
+
{
|
|
2068
|
+
error('React.jsx: type is invalid -- expected a string (for ' + 'built-in components) or a class/function (for composite ' + 'components) but got: %s.%s', typeString, info);
|
|
2069
|
+
}
|
|
1945
2070
|
}
|
|
1946
2071
|
|
|
1947
2072
|
var element = jsxDEV(type, props, key, source, self); // The result can be nullish if a mock or a custom function is used.
|
|
@@ -1970,7 +2095,9 @@ function jsxWithValidation(type, props, key, isStaticChildren, source, self) {
|
|
|
1970
2095
|
Object.freeze(children);
|
|
1971
2096
|
}
|
|
1972
2097
|
} else {
|
|
1973
|
-
|
|
2098
|
+
{
|
|
2099
|
+
error('React.jsx: Static children should always be an array. ' + 'You are likely explicitly calling React.jsxs or React.jsxDEV. ' + 'Use the Babel transform instead.');
|
|
2100
|
+
}
|
|
1974
2101
|
}
|
|
1975
2102
|
} else {
|
|
1976
2103
|
validateChildKeys(children, type);
|
|
@@ -1979,7 +2106,9 @@ function jsxWithValidation(type, props, key, isStaticChildren, source, self) {
|
|
|
1979
2106
|
}
|
|
1980
2107
|
|
|
1981
2108
|
if (hasOwnProperty$1.call(props, 'key')) {
|
|
1982
|
-
|
|
2109
|
+
{
|
|
2110
|
+
error('React.jsx: Spreading a key to JSX is a deprecated pattern. ' + 'Explicitly pass a key after spreading props in your JSX call. ' + 'E.g. <ComponentName {...props} key={key} />');
|
|
2111
|
+
}
|
|
1983
2112
|
}
|
|
1984
2113
|
|
|
1985
2114
|
if (type === REACT_FRAGMENT_TYPE) {
|
|
@@ -2032,7 +2161,9 @@ function createElementWithValidation(type, props, children) {
|
|
|
2032
2161
|
typeString = typeof type;
|
|
2033
2162
|
}
|
|
2034
2163
|
|
|
2035
|
-
|
|
2164
|
+
{
|
|
2165
|
+
error('React.createElement: type is invalid -- expected a string (for ' + 'built-in components) or a class/function (for composite ' + 'components) but got: %s.%s', typeString, info);
|
|
2166
|
+
}
|
|
2036
2167
|
}
|
|
2037
2168
|
|
|
2038
2169
|
var element = createElement.apply(this, arguments); // The result can be nullish if a mock or a custom function is used.
|
|
@@ -2061,15 +2192,24 @@ function createElementWithValidation(type, props, children) {
|
|
|
2061
2192
|
|
|
2062
2193
|
return element;
|
|
2063
2194
|
}
|
|
2195
|
+
var didWarnAboutDeprecatedCreateFactory = false;
|
|
2064
2196
|
function createFactoryWithValidation(type) {
|
|
2065
2197
|
var validatedFactory = createElementWithValidation.bind(null, type);
|
|
2066
|
-
validatedFactory.type = type;
|
|
2198
|
+
validatedFactory.type = type;
|
|
2067
2199
|
|
|
2068
2200
|
{
|
|
2201
|
+
if (!didWarnAboutDeprecatedCreateFactory) {
|
|
2202
|
+
didWarnAboutDeprecatedCreateFactory = true;
|
|
2203
|
+
|
|
2204
|
+
warn('React.createFactory() is deprecated and will be removed in ' + 'a future major release. Consider using JSX ' + 'or use React.createElement() directly instead.');
|
|
2205
|
+
} // Legacy hook: remove it
|
|
2206
|
+
|
|
2207
|
+
|
|
2069
2208
|
Object.defineProperty(validatedFactory, 'type', {
|
|
2070
2209
|
enumerable: false,
|
|
2071
2210
|
get: function () {
|
|
2072
|
-
|
|
2211
|
+
warn('Factory.type is deprecated. Access the class directly ' + 'before passing it to createFactory.');
|
|
2212
|
+
|
|
2073
2213
|
Object.defineProperty(this, 'type', {
|
|
2074
2214
|
value: type
|
|
2075
2215
|
});
|
|
@@ -2174,64 +2314,6 @@ function createScope() {
|
|
|
2174
2314
|
return scopeComponent;
|
|
2175
2315
|
}
|
|
2176
2316
|
|
|
2177
|
-
// Helps identify side effects in render-phase lifecycle hooks and setState
|
|
2178
|
-
// reducers by double invoking them in Strict Mode.
|
|
2179
|
-
|
|
2180
|
-
// To preserve the "Pause on caught exceptions" behavior of the debugger, we
|
|
2181
|
-
// replay the begin phase of a failed component inside invokeGuardedCallback.
|
|
2182
|
-
|
|
2183
|
-
// Warn about deprecated, async-unsafe lifecycles; relates to RFC #6:
|
|
2184
|
-
|
|
2185
|
-
// Gather advanced timing metrics for Profiler subtrees.
|
|
2186
|
-
|
|
2187
|
-
// Trace which interactions trigger each commit.
|
|
2188
|
-
|
|
2189
|
-
// SSR experiments
|
|
2190
|
-
|
|
2191
|
-
|
|
2192
|
-
// Only used in www builds.
|
|
2193
|
-
|
|
2194
|
-
// Only used in www builds.
|
|
2195
|
-
|
|
2196
|
-
// Disable javascript: URL strings in href for XSS protection.
|
|
2197
|
-
|
|
2198
|
-
// React Fire: prevent the value and checked attributes from syncing
|
|
2199
|
-
// with their related DOM properties
|
|
2200
|
-
|
|
2201
|
-
// These APIs will no longer be "unstable" in the upcoming 16.7 release,
|
|
2202
|
-
// Control this behavior with a flag to support 16.6 minor releases in the meanwhile.
|
|
2203
|
-
|
|
2204
|
-
var exposeConcurrentModeAPIs = true;
|
|
2205
|
-
// Experimental React Flare event system and event components support.
|
|
2206
|
-
|
|
2207
|
-
var enableFlareAPI = false; // Experimental Host Component support.
|
|
2208
|
-
|
|
2209
|
-
var enableFundamentalAPI = false; // Experimental Scope support.
|
|
2210
|
-
|
|
2211
|
-
var enableScopeAPI = false; // New API for JSX transforms to target - https://github.com/reactjs/rfcs/pull/107
|
|
2212
|
-
|
|
2213
|
-
var enableJSXTransformAPI = false; // We will enforce mocking scheduler with scheduler/unstable_mock at some point. (v17?)
|
|
2214
|
-
// Till then, we warn about the missing mock, but still fallback to a legacy mode compatible version
|
|
2215
|
-
|
|
2216
|
-
// For tests, we flush suspense fallbacks in an act scope;
|
|
2217
|
-
// *except* in some of our own tests, where we test incremental loading states.
|
|
2218
|
-
|
|
2219
|
-
// Add a callback property to suspense to notify which promises are currently
|
|
2220
|
-
// in the update queue. This allows reporting and tracing of what is causing
|
|
2221
|
-
// the user to see a loading state.
|
|
2222
|
-
// Also allows hydration callbacks to fire when a dehydrated boundary gets
|
|
2223
|
-
// hydrated or deleted.
|
|
2224
|
-
|
|
2225
|
-
// Part of the simplification of React.createElement so we can eventually move
|
|
2226
|
-
// from React.createElement to React.jsx
|
|
2227
|
-
// https://github.com/reactjs/rfcs/blob/createlement-rfc/text/0000-create-element-changes.md
|
|
2228
|
-
|
|
2229
|
-
|
|
2230
|
-
|
|
2231
|
-
|
|
2232
|
-
|
|
2233
|
-
// Flag to turn event.target and event.currentTarget in ReactNative from a reactTag to a component instance
|
|
2234
|
-
|
|
2235
2317
|
var React = {
|
|
2236
2318
|
Children: {
|
|
2237
2319
|
map: mapChildren,
|
|
@@ -2263,12 +2345,15 @@ var React = {
|
|
|
2263
2345
|
Suspense: REACT_SUSPENSE_TYPE,
|
|
2264
2346
|
createElement: createElementWithValidation,
|
|
2265
2347
|
cloneElement: cloneElementWithValidation,
|
|
2266
|
-
createFactory: createFactoryWithValidation,
|
|
2267
2348
|
isValidElement: isValidElement,
|
|
2268
2349
|
version: ReactVersion,
|
|
2269
2350
|
__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED: ReactSharedInternals
|
|
2270
2351
|
};
|
|
2271
2352
|
|
|
2353
|
+
if (!disableCreateFactory) {
|
|
2354
|
+
React.createFactory = createFactoryWithValidation;
|
|
2355
|
+
}
|
|
2356
|
+
|
|
2272
2357
|
if (exposeConcurrentModeAPIs) {
|
|
2273
2358
|
React.useTransition = useTransition;
|
|
2274
2359
|
React.useDeferredValue = useDeferredValue;
|
|
@@ -2276,9 +2361,13 @@ if (exposeConcurrentModeAPIs) {
|
|
|
2276
2361
|
React.unstable_withSuspenseConfig = withSuspenseConfig;
|
|
2277
2362
|
}
|
|
2278
2363
|
|
|
2279
|
-
if (
|
|
2280
|
-
React.
|
|
2281
|
-
|
|
2364
|
+
if (enableChunksAPI) {
|
|
2365
|
+
React.chunk = chunk;
|
|
2366
|
+
}
|
|
2367
|
+
|
|
2368
|
+
if (enableDeprecatedFlareAPI) {
|
|
2369
|
+
React.DEPRECATED_useResponder = useResponder;
|
|
2370
|
+
React.DEPRECATED_createResponder = createEventResponder;
|
|
2282
2371
|
}
|
|
2283
2372
|
|
|
2284
2373
|
if (enableFundamentalAPI) {
|