react 15.6.2 → 16.0.0-alpha.2
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/LICENSE +26 -16
- package/PATENTS +33 -0
- package/README.md +7 -0
- package/dist/react-with-addons.js +3772 -4326
- package/dist/react-with-addons.min.js +12 -6
- package/dist/react.js +2798 -3167
- package/dist/react.min.js +12 -5
- package/lib/KeyEscapeUtils.js +5 -3
- package/lib/PooledClass.js +5 -3
- package/lib/React.js +11 -46
- package/lib/ReactAddonsDOMDependencies.js +5 -3
- package/lib/ReactAddonsDOMDependenciesUMDShim.js +5 -3
- package/lib/ReactBaseClasses.js +9 -13
- package/lib/ReactCSSTransitionGroup.js +9 -9
- package/lib/ReactCSSTransitionGroupChild.js +118 -134
- package/lib/ReactChildren.js +9 -7
- package/lib/ReactClass.js +704 -0
- package/lib/ReactComponentTreeHook.js +63 -58
- package/lib/ReactComponentTreeHookUMDShim.js +5 -3
- package/lib/ReactComponentWithPureRenderMixin.js +5 -3
- package/lib/ReactCurrentOwner.js +7 -3
- package/lib/ReactCurrentOwnerUMDShim.js +5 -3
- package/lib/ReactDOMFactories.js +6 -3
- package/lib/ReactElement.js +9 -7
- package/lib/ReactElementSymbol.js +5 -3
- package/lib/ReactElementType.js +5 -3
- package/lib/ReactElementValidator.js +15 -14
- package/lib/ReactFragment.js +5 -3
- package/lib/ReactNoopUpdateQueue.js +16 -17
- package/lib/ReactPropTypeLocationNames.js +5 -3
- package/lib/ReactPropTypeLocations.js +5 -3
- package/lib/ReactPropTypes.js +460 -7
- package/lib/ReactPropTypesSecret.js +5 -3
- package/lib/ReactStateSetters.js +5 -3
- package/lib/ReactTransitionChildMapping.js +5 -3
- package/lib/ReactTransitionEvents.js +5 -3
- package/lib/ReactTransitionGroup.js +8 -12
- package/lib/ReactTypeOfWork.js +26 -0
- package/lib/ReactUMDEntry.js +8 -7
- package/lib/ReactUMDShim.js +5 -3
- package/lib/ReactVersion.js +6 -4
- package/lib/ReactWithAddons.js +5 -5
- package/lib/ReactWithAddonsUMDEntry.js +8 -7
- package/lib/canDefineProperty.js +5 -3
- package/lib/checkReactTypeSpec.js +21 -7
- package/lib/deprecated.js +8 -6
- package/lib/flattenChildren.js +5 -3
- package/lib/getComponentName.js +35 -0
- package/lib/getIteratorFn.js +5 -3
- package/lib/getNextDebugID.js +5 -3
- package/lib/onlyChild.js +6 -4
- package/lib/reactProdInvariant.js +4 -2
- package/lib/shallowCompare.js +5 -3
- package/lib/sliceChildren.js +5 -3
- package/lib/traverseAllChildren.js +20 -29
- package/lib/update.js +5 -3
- package/package.json +4 -5
- package/lib/LinkedStateMixin.js +0 -32
- package/lib/ReactComponentTreeDevtool.js +0 -12
- package/lib/ReactLink.js +0 -47
- package/lib/createClass.js +0 -20
- package/lib/getNextDebugIDUMDShim.js +0 -15
- package/lib/lowPriorityWarning.js +0 -62
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Copyright
|
|
2
|
+
* Copyright 2016-present, Facebook, Inc.
|
|
3
|
+
* All rights reserved.
|
|
3
4
|
*
|
|
4
|
-
* This source code is licensed under the
|
|
5
|
-
* LICENSE file in the root directory of this source tree.
|
|
5
|
+
* This source code is licensed under the BSD-style license found in the
|
|
6
|
+
* LICENSE file in the root directory of this source tree. An additional grant
|
|
7
|
+
* of patent rights can be found in the PATENTS file in the same directory.
|
|
6
8
|
*
|
|
7
9
|
*
|
|
8
10
|
*/
|
|
@@ -12,7 +14,14 @@
|
|
|
12
14
|
var _prodInvariant = require('./reactProdInvariant');
|
|
13
15
|
|
|
14
16
|
var ReactCurrentOwner = require('./ReactCurrentOwner');
|
|
17
|
+
var ReactTypeOfWork = require('./ReactTypeOfWork');
|
|
18
|
+
var IndeterminateComponent = ReactTypeOfWork.IndeterminateComponent,
|
|
19
|
+
FunctionalComponent = ReactTypeOfWork.FunctionalComponent,
|
|
20
|
+
ClassComponent = ReactTypeOfWork.ClassComponent,
|
|
21
|
+
HostComponent = ReactTypeOfWork.HostComponent;
|
|
15
22
|
|
|
23
|
+
|
|
24
|
+
var getComponentName = require('./getComponentName');
|
|
16
25
|
var invariant = require('fbjs/lib/invariant');
|
|
17
26
|
var warning = require('fbjs/lib/warning');
|
|
18
27
|
|
|
@@ -22,11 +31,11 @@ function isNative(fn) {
|
|
|
22
31
|
var hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
23
32
|
var reIsNative = RegExp('^' + funcToString
|
|
24
33
|
// Take an example native function source for comparison
|
|
25
|
-
.call(hasOwnProperty
|
|
34
|
+
.call(hasOwnProperty)
|
|
26
35
|
// Strip regex characters so we can use it for regex
|
|
27
|
-
|
|
36
|
+
.replace(/[\\^$.*+?()[\]{}|]/g, '\\$&')
|
|
28
37
|
// Remove hasOwnProperty from the template to make it generic
|
|
29
|
-
|
|
38
|
+
.replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$');
|
|
30
39
|
try {
|
|
31
40
|
var source = funcToString.call(fn);
|
|
32
41
|
return reIsNative.test(source);
|
|
@@ -163,10 +172,29 @@ function describeID(id) {
|
|
|
163
172
|
return describeComponentFrame(name, element && element._source, ownerName);
|
|
164
173
|
}
|
|
165
174
|
|
|
175
|
+
function describeFiber(fiber) {
|
|
176
|
+
switch (fiber.tag) {
|
|
177
|
+
case IndeterminateComponent:
|
|
178
|
+
case FunctionalComponent:
|
|
179
|
+
case ClassComponent:
|
|
180
|
+
case HostComponent:
|
|
181
|
+
var owner = fiber._debugOwner;
|
|
182
|
+
var source = fiber._debugSource;
|
|
183
|
+
var name = getComponentName(fiber);
|
|
184
|
+
var ownerName = null;
|
|
185
|
+
if (owner) {
|
|
186
|
+
ownerName = getComponentName(owner);
|
|
187
|
+
}
|
|
188
|
+
return describeComponentFrame(name, source, ownerName);
|
|
189
|
+
default:
|
|
190
|
+
return '';
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
|
|
166
194
|
var ReactComponentTreeHook = {
|
|
167
195
|
onSetChildren: function (id, nextChildIDs) {
|
|
168
196
|
var item = getItem(id);
|
|
169
|
-
|
|
197
|
+
invariant(item, 'Item must have been set');
|
|
170
198
|
item.childIDs = nextChildIDs;
|
|
171
199
|
|
|
172
200
|
for (var i = 0; i < nextChildIDs.length; i++) {
|
|
@@ -206,7 +234,7 @@ var ReactComponentTreeHook = {
|
|
|
206
234
|
},
|
|
207
235
|
onMountComponent: function (id) {
|
|
208
236
|
var item = getItem(id);
|
|
209
|
-
|
|
237
|
+
invariant(item, 'Item must have been set');
|
|
210
238
|
item.isMounted = true;
|
|
211
239
|
var isRoot = item.parentID === 0;
|
|
212
240
|
if (isRoot) {
|
|
@@ -259,13 +287,20 @@ var ReactComponentTreeHook = {
|
|
|
259
287
|
if (topElement) {
|
|
260
288
|
var name = getDisplayName(topElement);
|
|
261
289
|
var owner = topElement._owner;
|
|
262
|
-
info += describeComponentFrame(name, topElement._source, owner && owner
|
|
290
|
+
info += describeComponentFrame(name, topElement._source, owner && getComponentName(owner));
|
|
263
291
|
}
|
|
264
292
|
|
|
265
293
|
var currentOwner = ReactCurrentOwner.current;
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
294
|
+
if (currentOwner) {
|
|
295
|
+
if (typeof currentOwner.tag === 'number') {
|
|
296
|
+
var workInProgress = currentOwner;
|
|
297
|
+
// Safe because if current owner exists, we are reconciling,
|
|
298
|
+
// and it is guaranteed to be the work-in-progress version.
|
|
299
|
+
info += ReactComponentTreeHook.getStackAddendumByWorkInProgressFiber(workInProgress);
|
|
300
|
+
} else if (typeof currentOwner._debugID === 'number') {
|
|
301
|
+
info += ReactComponentTreeHook.getStackAddendumByID(currentOwner._debugID);
|
|
302
|
+
}
|
|
303
|
+
}
|
|
269
304
|
return info;
|
|
270
305
|
},
|
|
271
306
|
getStackAddendumByID: function (id) {
|
|
@@ -276,6 +311,21 @@ var ReactComponentTreeHook = {
|
|
|
276
311
|
}
|
|
277
312
|
return info;
|
|
278
313
|
},
|
|
314
|
+
|
|
315
|
+
|
|
316
|
+
// This function can only be called with a work-in-progress fiber and
|
|
317
|
+
// only during begin or complete phase. Do not call it under any other
|
|
318
|
+
// circumstances.
|
|
319
|
+
getStackAddendumByWorkInProgressFiber: function (workInProgress) {
|
|
320
|
+
var info = '';
|
|
321
|
+
var node = workInProgress;
|
|
322
|
+
do {
|
|
323
|
+
info += describeFiber(node);
|
|
324
|
+
// Otherwise this return pointer might point to the wrong tree:
|
|
325
|
+
node = node['return'];
|
|
326
|
+
} while (node);
|
|
327
|
+
return info;
|
|
328
|
+
},
|
|
279
329
|
getChildIDs: function (id) {
|
|
280
330
|
var item = getItem(id);
|
|
281
331
|
return item ? item.childIDs : [];
|
|
@@ -325,52 +375,7 @@ var ReactComponentTreeHook = {
|
|
|
325
375
|
|
|
326
376
|
|
|
327
377
|
getRootIDs: getRootIDs,
|
|
328
|
-
getRegisteredIDs: getItemIDs
|
|
329
|
-
|
|
330
|
-
pushNonStandardWarningStack: function (isCreatingElement, currentSource) {
|
|
331
|
-
if (typeof console.reactStack !== 'function') {
|
|
332
|
-
return;
|
|
333
|
-
}
|
|
334
|
-
|
|
335
|
-
var stack = [];
|
|
336
|
-
var currentOwner = ReactCurrentOwner.current;
|
|
337
|
-
var id = currentOwner && currentOwner._debugID;
|
|
338
|
-
|
|
339
|
-
try {
|
|
340
|
-
if (isCreatingElement) {
|
|
341
|
-
stack.push({
|
|
342
|
-
name: id ? ReactComponentTreeHook.getDisplayName(id) : null,
|
|
343
|
-
fileName: currentSource ? currentSource.fileName : null,
|
|
344
|
-
lineNumber: currentSource ? currentSource.lineNumber : null
|
|
345
|
-
});
|
|
346
|
-
}
|
|
347
|
-
|
|
348
|
-
while (id) {
|
|
349
|
-
var element = ReactComponentTreeHook.getElement(id);
|
|
350
|
-
var parentID = ReactComponentTreeHook.getParentID(id);
|
|
351
|
-
var ownerID = ReactComponentTreeHook.getOwnerID(id);
|
|
352
|
-
var ownerName = ownerID ? ReactComponentTreeHook.getDisplayName(ownerID) : null;
|
|
353
|
-
var source = element && element._source;
|
|
354
|
-
stack.push({
|
|
355
|
-
name: ownerName,
|
|
356
|
-
fileName: source ? source.fileName : null,
|
|
357
|
-
lineNumber: source ? source.lineNumber : null
|
|
358
|
-
});
|
|
359
|
-
id = parentID;
|
|
360
|
-
}
|
|
361
|
-
} catch (err) {
|
|
362
|
-
// Internal state is messed up.
|
|
363
|
-
// Stop building the stack (it's just a nice to have).
|
|
364
|
-
}
|
|
365
|
-
|
|
366
|
-
console.reactStack(stack);
|
|
367
|
-
},
|
|
368
|
-
popNonStandardWarningStack: function () {
|
|
369
|
-
if (typeof console.reactStackEnd !== 'function') {
|
|
370
|
-
return;
|
|
371
|
-
}
|
|
372
|
-
console.reactStackEnd();
|
|
373
|
-
}
|
|
378
|
+
getRegisteredIDs: getItemIDs
|
|
374
379
|
};
|
|
375
380
|
|
|
376
381
|
module.exports = ReactComponentTreeHook;
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Copyright
|
|
2
|
+
* Copyright 2013-present, Facebook, Inc.
|
|
3
|
+
* All rights reserved.
|
|
3
4
|
*
|
|
4
|
-
* This source code is licensed under the
|
|
5
|
-
* LICENSE file in the root directory of this source tree.
|
|
5
|
+
* This source code is licensed under the BSD-style license found in the
|
|
6
|
+
* LICENSE file in the root directory of this source tree. An additional grant
|
|
7
|
+
* of patent rights can be found in the PATENTS file in the same directory.
|
|
6
8
|
*
|
|
7
9
|
*/
|
|
8
10
|
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Copyright
|
|
2
|
+
* Copyright 2013-present, Facebook, Inc.
|
|
3
|
+
* All rights reserved.
|
|
3
4
|
*
|
|
4
|
-
* This source code is licensed under the
|
|
5
|
-
* LICENSE file in the root directory of this source tree.
|
|
5
|
+
* This source code is licensed under the BSD-style license found in the
|
|
6
|
+
* LICENSE file in the root directory of this source tree. An additional grant
|
|
7
|
+
* of patent rights can be found in the PATENTS file in the same directory.
|
|
6
8
|
*
|
|
7
9
|
*/
|
|
8
10
|
|
package/lib/ReactCurrentOwner.js
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Copyright
|
|
2
|
+
* Copyright 2013-present, Facebook, Inc.
|
|
3
|
+
* All rights reserved.
|
|
3
4
|
*
|
|
4
|
-
* This source code is licensed under the
|
|
5
|
-
* LICENSE file in the root directory of this source tree.
|
|
5
|
+
* This source code is licensed under the BSD-style license found in the
|
|
6
|
+
* LICENSE file in the root directory of this source tree. An additional grant
|
|
7
|
+
* of patent rights can be found in the PATENTS file in the same directory.
|
|
6
8
|
*
|
|
7
9
|
*
|
|
8
10
|
*/
|
|
@@ -16,11 +18,13 @@
|
|
|
16
18
|
* currently being constructed.
|
|
17
19
|
*/
|
|
18
20
|
var ReactCurrentOwner = {
|
|
21
|
+
|
|
19
22
|
/**
|
|
20
23
|
* @internal
|
|
21
24
|
* @type {ReactComponent}
|
|
22
25
|
*/
|
|
23
26
|
current: null
|
|
27
|
+
|
|
24
28
|
};
|
|
25
29
|
|
|
26
30
|
module.exports = ReactCurrentOwner;
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Copyright
|
|
2
|
+
* Copyright 2013-present, Facebook, Inc.
|
|
3
|
+
* All rights reserved.
|
|
3
4
|
*
|
|
4
|
-
* This source code is licensed under the
|
|
5
|
-
* LICENSE file in the root directory of this source tree.
|
|
5
|
+
* This source code is licensed under the BSD-style license found in the
|
|
6
|
+
* LICENSE file in the root directory of this source tree. An additional grant
|
|
7
|
+
* of patent rights can be found in the PATENTS file in the same directory.
|
|
6
8
|
*
|
|
7
9
|
*/
|
|
8
10
|
|
package/lib/ReactDOMFactories.js
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Copyright
|
|
2
|
+
* Copyright 2013-present, Facebook, Inc.
|
|
3
|
+
* All rights reserved.
|
|
3
4
|
*
|
|
4
|
-
* This source code is licensed under the
|
|
5
|
-
* LICENSE file in the root directory of this source tree.
|
|
5
|
+
* This source code is licensed under the BSD-style license found in the
|
|
6
|
+
* LICENSE file in the root directory of this source tree. An additional grant
|
|
7
|
+
* of patent rights can be found in the PATENTS file in the same directory.
|
|
6
8
|
*
|
|
7
9
|
*/
|
|
8
10
|
|
|
@@ -23,6 +25,7 @@ if (process.env.NODE_ENV !== 'production') {
|
|
|
23
25
|
|
|
24
26
|
/**
|
|
25
27
|
* Creates a mapping from supported HTML tags to `ReactDOMComponent` classes.
|
|
28
|
+
* This is also accessible via `React.DOM`.
|
|
26
29
|
*
|
|
27
30
|
* @public
|
|
28
31
|
*/
|
package/lib/ReactElement.js
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Copyright
|
|
2
|
+
* Copyright 2014-present, Facebook, Inc.
|
|
3
|
+
* All rights reserved.
|
|
3
4
|
*
|
|
4
|
-
* This source code is licensed under the
|
|
5
|
-
* LICENSE file in the root directory of this source tree.
|
|
5
|
+
* This source code is licensed under the BSD-style license found in the
|
|
6
|
+
* LICENSE file in the root directory of this source tree. An additional grant
|
|
7
|
+
* of patent rights can be found in the PATENTS file in the same directory.
|
|
6
8
|
*
|
|
7
9
|
*/
|
|
8
10
|
|
|
@@ -163,7 +165,7 @@ var ReactElement = function (type, key, ref, self, source, owner, props) {
|
|
|
163
165
|
|
|
164
166
|
/**
|
|
165
167
|
* Create and return a new ReactElement of the given type.
|
|
166
|
-
* See https://facebook.github.io/react/docs/
|
|
168
|
+
* See https://facebook.github.io/react/docs/react-api.html#createelement
|
|
167
169
|
*/
|
|
168
170
|
ReactElement.createElement = function (type, config, children) {
|
|
169
171
|
var propName;
|
|
@@ -239,7 +241,7 @@ ReactElement.createElement = function (type, config, children) {
|
|
|
239
241
|
|
|
240
242
|
/**
|
|
241
243
|
* Return a function that produces ReactElements of a given type.
|
|
242
|
-
* See https://facebook.github.io/react/docs/
|
|
244
|
+
* See https://facebook.github.io/react/docs/react-api.html#createfactory
|
|
243
245
|
*/
|
|
244
246
|
ReactElement.createFactory = function (type) {
|
|
245
247
|
var factory = ReactElement.createElement.bind(null, type);
|
|
@@ -260,7 +262,7 @@ ReactElement.cloneAndReplaceKey = function (oldElement, newKey) {
|
|
|
260
262
|
|
|
261
263
|
/**
|
|
262
264
|
* Clone and return a new ReactElement using element as the starting point.
|
|
263
|
-
* See https://facebook.github.io/react/docs/
|
|
265
|
+
* See https://facebook.github.io/react/docs/react-api.html#cloneelement
|
|
264
266
|
*/
|
|
265
267
|
ReactElement.cloneElement = function (element, config, children) {
|
|
266
268
|
var propName;
|
|
@@ -326,7 +328,7 @@ ReactElement.cloneElement = function (element, config, children) {
|
|
|
326
328
|
|
|
327
329
|
/**
|
|
328
330
|
* Verifies the object is a ReactElement.
|
|
329
|
-
* See https://facebook.github.io/react/docs/
|
|
331
|
+
* See https://facebook.github.io/react/docs/react-api.html#isvalidelement
|
|
330
332
|
* @param {?object} object
|
|
331
333
|
* @return {boolean} True if `object` is a valid component.
|
|
332
334
|
* @final
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Copyright
|
|
2
|
+
* Copyright 2014-present, Facebook, Inc.
|
|
3
|
+
* All rights reserved.
|
|
3
4
|
*
|
|
4
|
-
* This source code is licensed under the
|
|
5
|
-
* LICENSE file in the root directory of this source tree.
|
|
5
|
+
* This source code is licensed under the BSD-style license found in the
|
|
6
|
+
* LICENSE file in the root directory of this source tree. An additional grant
|
|
7
|
+
* of patent rights can be found in the PATENTS file in the same directory.
|
|
6
8
|
*
|
|
7
9
|
*
|
|
8
10
|
*/
|
package/lib/ReactElementType.js
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Copyright
|
|
2
|
+
* Copyright 2016-present, Facebook, Inc.
|
|
3
|
+
* All rights reserved.
|
|
3
4
|
*
|
|
4
|
-
* This source code is licensed under the
|
|
5
|
-
* LICENSE file in the root directory of this source tree.
|
|
5
|
+
* This source code is licensed under the BSD-style license found in the
|
|
6
|
+
* LICENSE file in the root directory of this source tree. An additional grant
|
|
7
|
+
* of patent rights can be found in the PATENTS file in the same directory.
|
|
6
8
|
*
|
|
7
9
|
*
|
|
8
10
|
*/
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Copyright
|
|
2
|
+
* Copyright 2014-present, Facebook, Inc.
|
|
3
|
+
* All rights reserved.
|
|
3
4
|
*
|
|
4
|
-
* This source code is licensed under the
|
|
5
|
-
* LICENSE file in the root directory of this source tree.
|
|
5
|
+
* This source code is licensed under the BSD-style license found in the
|
|
6
|
+
* LICENSE file in the root directory of this source tree. An additional grant
|
|
7
|
+
* of patent rights can be found in the PATENTS file in the same directory.
|
|
6
8
|
*
|
|
7
9
|
*/
|
|
8
10
|
|
|
@@ -22,15 +24,15 @@ var ReactElement = require('./ReactElement');
|
|
|
22
24
|
var checkReactTypeSpec = require('./checkReactTypeSpec');
|
|
23
25
|
|
|
24
26
|
var canDefineProperty = require('./canDefineProperty');
|
|
27
|
+
var getComponentName = require('./getComponentName');
|
|
25
28
|
var getIteratorFn = require('./getIteratorFn');
|
|
26
29
|
var warning = require('fbjs/lib/warning');
|
|
27
|
-
var lowPriorityWarning = require('./lowPriorityWarning');
|
|
28
30
|
|
|
29
31
|
function getDeclarationErrorAddendum() {
|
|
30
32
|
if (ReactCurrentOwner.current) {
|
|
31
|
-
var name = ReactCurrentOwner.current
|
|
33
|
+
var name = getComponentName(ReactCurrentOwner.current);
|
|
32
34
|
if (name) {
|
|
33
|
-
return '
|
|
35
|
+
return '\n\nCheck the render method of `' + name + '`.';
|
|
34
36
|
}
|
|
35
37
|
}
|
|
36
38
|
return '';
|
|
@@ -41,7 +43,7 @@ function getSourceInfoErrorAddendum(elementProps) {
|
|
|
41
43
|
var source = elementProps.__source;
|
|
42
44
|
var fileName = source.fileName.replace(/^.*[\\\/]/, '');
|
|
43
45
|
var lineNumber = source.lineNumber;
|
|
44
|
-
return '
|
|
46
|
+
return '\n\nCheck your code at ' + fileName + ':' + lineNumber + '.';
|
|
45
47
|
}
|
|
46
48
|
return '';
|
|
47
49
|
}
|
|
@@ -59,7 +61,7 @@ function getCurrentComponentErrorInfo(parentType) {
|
|
|
59
61
|
if (!info) {
|
|
60
62
|
var parentName = typeof parentType === 'string' ? parentType : parentType.displayName || parentType.name;
|
|
61
63
|
if (parentName) {
|
|
62
|
-
info = '
|
|
64
|
+
info = '\n\nCheck the top-level render call using <' + parentName + '>.';
|
|
63
65
|
}
|
|
64
66
|
}
|
|
65
67
|
return info;
|
|
@@ -96,7 +98,7 @@ function validateExplicitKey(element, parentType) {
|
|
|
96
98
|
var childOwner = '';
|
|
97
99
|
if (element && element._owner && element._owner !== ReactCurrentOwner.current) {
|
|
98
100
|
// Give the component that originally created this child.
|
|
99
|
-
childOwner = ' It was passed a child from ' + element._owner
|
|
101
|
+
childOwner = ' It was passed a child from ' + getComponentName(element._owner) + '.';
|
|
100
102
|
}
|
|
101
103
|
|
|
102
104
|
process.env.NODE_ENV !== 'production' ? warning(false, 'Each child in an array or iterator should have a unique "key" prop.' + '%s%s See https://fb.me/react-warning-keys for more information.%s', currentComponentErrorInfo, childOwner, ReactComponentTreeHook.getCurrentStackAddendum(element)) : void 0;
|
|
@@ -165,6 +167,7 @@ function validatePropTypes(element) {
|
|
|
165
167
|
}
|
|
166
168
|
|
|
167
169
|
var ReactElementValidator = {
|
|
170
|
+
|
|
168
171
|
createElement: function (type, props, children) {
|
|
169
172
|
var validType = typeof type === 'string' || typeof type === 'function';
|
|
170
173
|
// We warn in this case but don't throw. We expect the element creation to
|
|
@@ -173,7 +176,7 @@ var ReactElementValidator = {
|
|
|
173
176
|
if (typeof type !== 'function' && typeof type !== 'string') {
|
|
174
177
|
var info = '';
|
|
175
178
|
if (type === undefined || typeof type === 'object' && type !== null && Object.keys(type).length === 0) {
|
|
176
|
-
info += ' You likely forgot to export your component from the file ' +
|
|
179
|
+
info += ' You likely forgot to export your component from the file ' + 'it\'s defined in.';
|
|
177
180
|
}
|
|
178
181
|
|
|
179
182
|
var sourceInfo = getSourceInfoErrorAddendum(props);
|
|
@@ -185,10 +188,7 @@ var ReactElementValidator = {
|
|
|
185
188
|
|
|
186
189
|
info += ReactComponentTreeHook.getCurrentStackAddendum();
|
|
187
190
|
|
|
188
|
-
var currentSource = props !== null && props !== undefined && props.__source !== undefined ? props.__source : null;
|
|
189
|
-
ReactComponentTreeHook.pushNonStandardWarningStack(true, currentSource);
|
|
190
191
|
process.env.NODE_ENV !== 'production' ? warning(false, 'React.createElement: type is invalid -- expected a string (for ' + 'built-in components) or a class/function (for composite ' + 'components) but got: %s.%s', type == null ? type : typeof type, info) : void 0;
|
|
191
|
-
ReactComponentTreeHook.popNonStandardWarningStack();
|
|
192
192
|
}
|
|
193
193
|
}
|
|
194
194
|
|
|
@@ -226,7 +226,7 @@ var ReactElementValidator = {
|
|
|
226
226
|
Object.defineProperty(validatedFactory, 'type', {
|
|
227
227
|
enumerable: false,
|
|
228
228
|
get: function () {
|
|
229
|
-
|
|
229
|
+
process.env.NODE_ENV !== 'production' ? warning(false, 'Factory.type is deprecated. Access the class directly ' + 'before passing it to createFactory.') : void 0;
|
|
230
230
|
Object.defineProperty(this, 'type', {
|
|
231
231
|
value: type
|
|
232
232
|
});
|
|
@@ -247,6 +247,7 @@ var ReactElementValidator = {
|
|
|
247
247
|
validatePropTypes(newElement);
|
|
248
248
|
return newElement;
|
|
249
249
|
}
|
|
250
|
+
|
|
250
251
|
};
|
|
251
252
|
|
|
252
253
|
module.exports = ReactElementValidator;
|