react 15.7.0 → 16.0.0-alpha.3

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 (71) hide show
  1. package/LICENSE +26 -16
  2. package/PATENTS +33 -0
  3. package/README.md +7 -0
  4. package/dist/react-with-addons.js +3798 -4340
  5. package/dist/react-with-addons.min.js +12 -6
  6. package/dist/react.js +2834 -3191
  7. package/dist/react.min.js +12 -5
  8. package/lib/KeyEscapeUtils.js +5 -3
  9. package/lib/PooledClass.js +5 -3
  10. package/lib/React.js +14 -57
  11. package/lib/ReactAddonsDOMDependencies.js +5 -3
  12. package/lib/ReactAddonsDOMDependenciesUMDShim.js +5 -3
  13. package/lib/ReactBaseClasses.js +9 -13
  14. package/lib/ReactCSSTransitionGroup.js +9 -9
  15. package/lib/ReactCSSTransitionGroupChild.js +118 -134
  16. package/lib/ReactChildren.js +9 -7
  17. package/lib/ReactClass.js +703 -0
  18. package/lib/ReactComponentTreeHook.js +63 -58
  19. package/lib/ReactComponentTreeHookUMDShim.js +5 -3
  20. package/lib/ReactComponentWithPureRenderMixin.js +5 -3
  21. package/lib/ReactCurrentOwner.js +7 -3
  22. package/lib/ReactCurrentOwnerUMDShim.js +5 -3
  23. package/lib/ReactDOMFactories.js +6 -3
  24. package/lib/ReactDebugCurrentFrame.js +53 -0
  25. package/lib/ReactElement.js +9 -7
  26. package/lib/ReactElementSymbol.js +5 -3
  27. package/lib/ReactElementType.js +5 -3
  28. package/lib/ReactElementValidator.js +46 -29
  29. package/lib/ReactFragment.js +5 -3
  30. package/lib/ReactNoopUpdateQueue.js +16 -17
  31. package/lib/ReactPropTypes.js +449 -7
  32. package/lib/ReactPropTypesSecret.js +5 -3
  33. package/lib/ReactStateSetters.js +5 -3
  34. package/lib/ReactTransitionChildMapping.js +5 -3
  35. package/lib/ReactTransitionEvents.js +5 -3
  36. package/lib/ReactTransitionGroup.js +8 -12
  37. package/lib/ReactTypeOfWork.js +26 -0
  38. package/lib/ReactUMDEntry.js +8 -7
  39. package/lib/ReactUMDShim.js +5 -3
  40. package/lib/ReactVersion.js +6 -4
  41. package/lib/ReactWithAddons.js +5 -5
  42. package/lib/ReactWithAddonsUMDEntry.js +8 -7
  43. package/lib/canDefineProperty.js +5 -3
  44. package/lib/checkPropTypes.js +64 -0
  45. package/lib/checkReactTypeSpec.js +10 -72
  46. package/lib/deprecated.js +8 -6
  47. package/lib/flattenChildren.js +5 -3
  48. package/lib/getComponentName.js +35 -0
  49. package/lib/getIteratorFn.js +5 -3
  50. package/lib/getNextDebugID.js +5 -3
  51. package/lib/onlyChild.js +6 -4
  52. package/lib/reactProdInvariant.js +4 -2
  53. package/lib/shallowCompare.js +5 -3
  54. package/lib/sliceChildren.js +5 -3
  55. package/lib/traverseAllChildren.js +20 -29
  56. package/lib/update.js +5 -3
  57. package/package.json +24 -35
  58. package/cjs/react-jsx-dev-runtime.development.js +0 -866
  59. package/cjs/react-jsx-dev-runtime.production.min.js +0 -9
  60. package/cjs/react-jsx-runtime.development.js +0 -888
  61. package/cjs/react-jsx-runtime.production.min.js +0 -10
  62. package/jsx-dev-runtime.js +0 -7
  63. package/jsx-runtime.js +0 -7
  64. package/lib/LinkedStateMixin.js +0 -32
  65. package/lib/ReactComponentTreeDevtool.js +0 -12
  66. package/lib/ReactLink.js +0 -47
  67. package/lib/ReactPropTypeLocationNames.js +0 -22
  68. package/lib/ReactPropTypeLocations.js +0 -10
  69. package/lib/createClass.js +0 -20
  70. package/lib/getNextDebugIDUMDShim.js +0 -15
  71. package/lib/lowPriorityWarning.js +0 -62
@@ -1,8 +1,10 @@
1
1
  /**
2
- * Copyright (c) 2016-present, Facebook, Inc.
2
+ * Copyright 2016-present, Facebook, Inc.
3
+ * All rights reserved.
3
4
  *
4
- * This source code is licensed under the MIT license found in 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
- ).replace(/[\\^$.*+?()[\]{}|]/g, '\\$&'
36
+ .replace(/[\\^$.*+?()[\]{}|]/g, '\\$&')
28
37
  // Remove hasOwnProperty from the template to make it generic
29
- ).replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$');
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
- !item ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Item must have been set') : _prodInvariant('144') : void 0;
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
- !item ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Item must have been set') : _prodInvariant('144') : void 0;
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.getName());
290
+ info += describeComponentFrame(name, topElement._source, owner && getComponentName(owner));
263
291
  }
264
292
 
265
293
  var currentOwner = ReactCurrentOwner.current;
266
- var id = currentOwner && currentOwner._debugID;
267
-
268
- info += ReactComponentTreeHook.getStackAddendumByID(id);
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 (c) 2013-present, Facebook, Inc.
2
+ * Copyright 2013-present, Facebook, Inc.
3
+ * All rights reserved.
3
4
  *
4
- * This source code is licensed under the MIT license found in 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 (c) 2013-present, Facebook, Inc.
2
+ * Copyright 2013-present, Facebook, Inc.
3
+ * All rights reserved.
3
4
  *
4
- * This source code is licensed under the MIT license found in 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 (c) 2013-present, Facebook, Inc.
2
+ * Copyright 2013-present, Facebook, Inc.
3
+ * All rights reserved.
3
4
  *
4
- * This source code is licensed under the MIT license found in 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 (c) 2013-present, Facebook, Inc.
2
+ * Copyright 2013-present, Facebook, Inc.
3
+ * All rights reserved.
3
4
  *
4
- * This source code is licensed under the MIT license found in 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 (c) 2013-present, Facebook, Inc.
2
+ * Copyright 2013-present, Facebook, Inc.
3
+ * All rights reserved.
3
4
  *
4
- * This source code is licensed under the MIT license found in 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
  */
@@ -0,0 +1,53 @@
1
+ /**
2
+ * Copyright 2013-present, Facebook, Inc.
3
+ * All rights reserved.
4
+ *
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.
8
+ *
9
+ *
10
+ */
11
+
12
+ 'use strict';
13
+
14
+ var ReactDebugCurrentFrame = {};
15
+
16
+ if (process.env.NODE_ENV !== 'production') {
17
+ var _require = require('./ReactComponentTreeHook'),
18
+ getStackAddendumByID = _require.getStackAddendumByID,
19
+ getStackAddendumByWorkInProgressFiber = _require.getStackAddendumByWorkInProgressFiber,
20
+ getCurrentStackAddendum = _require.getCurrentStackAddendum;
21
+
22
+ // Component that is being worked on
23
+
24
+
25
+ ReactDebugCurrentFrame.current = null;
26
+
27
+ // Element that is being cloned or created
28
+ ReactDebugCurrentFrame.element = null;
29
+
30
+ ReactDebugCurrentFrame.getStackAddendum = function () {
31
+ var stack = null;
32
+ var current = ReactDebugCurrentFrame.current;
33
+ var element = ReactDebugCurrentFrame.element;
34
+ if (current !== null) {
35
+ if (typeof current === 'number') {
36
+ // DebugID from Stack.
37
+ var debugID = current;
38
+ stack = getStackAddendumByID(debugID);
39
+ } else if (typeof current.tag === 'number') {
40
+ // This is a Fiber.
41
+ // The stack will only be correct if this is a work in progress
42
+ // version and we're calling it during reconciliation.
43
+ var workInProgress = current;
44
+ stack = getStackAddendumByWorkInProgressFiber(workInProgress);
45
+ }
46
+ } else if (element !== null) {
47
+ stack = getCurrentStackAddendum(element);
48
+ }
49
+ return stack;
50
+ };
51
+ }
52
+
53
+ module.exports = ReactDebugCurrentFrame;
@@ -1,8 +1,10 @@
1
1
  /**
2
- * Copyright (c) 2014-present, Facebook, Inc.
2
+ * Copyright 2014-present, Facebook, Inc.
3
+ * All rights reserved.
3
4
  *
4
- * This source code is licensed under the MIT license found in 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/top-level-api.html#react.createelement
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/top-level-api.html#react.createfactory
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/top-level-api.html#react.cloneelement
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/top-level-api.html#react.isvalidelement
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 (c) 2014-present, Facebook, Inc.
2
+ * Copyright 2014-present, Facebook, Inc.
3
+ * All rights reserved.
3
4
  *
4
- * This source code is licensed under the MIT license found in 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 (c) 2016-present, Facebook, Inc.
2
+ * Copyright 2016-present, Facebook, Inc.
3
+ * All rights reserved.
3
4
  *
4
- * This source code is licensed under the MIT license found in 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 (c) 2014-present, Facebook, Inc.
2
+ * Copyright 2014-present, Facebook, Inc.
3
+ * All rights reserved.
3
4
  *
4
- * This source code is licensed under the MIT license found in 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,19 @@ 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
- var warning = require('fbjs/lib/warning');
27
- var lowPriorityWarning = require('./lowPriorityWarning');
29
+
30
+ if (process.env.NODE_ENV !== 'production') {
31
+ var warning = require('fbjs/lib/warning');
32
+ var ReactDebugCurrentFrame = require('./ReactDebugCurrentFrame');
33
+ }
28
34
 
29
35
  function getDeclarationErrorAddendum() {
30
36
  if (ReactCurrentOwner.current) {
31
- var name = ReactCurrentOwner.current.getName();
37
+ var name = getComponentName(ReactCurrentOwner.current);
32
38
  if (name) {
33
- return ' Check the render method of `' + name + '`.';
39
+ return '\n\nCheck the render method of `' + name + '`.';
34
40
  }
35
41
  }
36
42
  return '';
@@ -41,7 +47,7 @@ function getSourceInfoErrorAddendum(elementProps) {
41
47
  var source = elementProps.__source;
42
48
  var fileName = source.fileName.replace(/^.*[\\\/]/, '');
43
49
  var lineNumber = source.lineNumber;
44
- return ' Check your code at ' + fileName + ':' + lineNumber + '.';
50
+ return '\n\nCheck your code at ' + fileName + ':' + lineNumber + '.';
45
51
  }
46
52
  return '';
47
53
  }
@@ -59,7 +65,7 @@ function getCurrentComponentErrorInfo(parentType) {
59
65
  if (!info) {
60
66
  var parentName = typeof parentType === 'string' ? parentType : parentType.displayName || parentType.name;
61
67
  if (parentName) {
62
- info = ' Check the top-level render call using <' + parentName + '>.';
68
+ info = '\n\nCheck the top-level render call using <' + parentName + '>.';
63
69
  }
64
70
  }
65
71
  return info;
@@ -96,7 +102,7 @@ function validateExplicitKey(element, parentType) {
96
102
  var childOwner = '';
97
103
  if (element && element._owner && element._owner !== ReactCurrentOwner.current) {
98
104
  // Give the component that originally created this child.
99
- childOwner = ' It was passed a child from ' + element._owner.getName() + '.';
105
+ childOwner = ' It was passed a child from ' + getComponentName(element._owner) + '.';
100
106
  }
101
107
 
102
108
  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;
@@ -157,7 +163,7 @@ function validatePropTypes(element) {
157
163
  }
158
164
  var name = componentClass.displayName || componentClass.name;
159
165
  if (componentClass.propTypes) {
160
- checkReactTypeSpec(componentClass.propTypes, element.props, 'prop', name, element, null);
166
+ checkReactTypeSpec(componentClass.propTypes, element.props, 'prop', name);
161
167
  }
162
168
  if (typeof componentClass.getDefaultProps === 'function') {
163
169
  process.env.NODE_ENV !== 'production' ? warning(componentClass.getDefaultProps.isReactClassApproved, 'getDefaultProps is only used on classic React.createClass ' + 'definitions. Use a static property named `defaultProps` instead.') : void 0;
@@ -165,31 +171,27 @@ function validatePropTypes(element) {
165
171
  }
166
172
 
167
173
  var ReactElementValidator = {
174
+
168
175
  createElement: function (type, props, children) {
169
176
  var validType = typeof type === 'string' || typeof type === 'function';
170
177
  // We warn in this case but don't throw. We expect the element creation to
171
178
  // succeed and there will likely be errors in render.
172
179
  if (!validType) {
173
- if (typeof type !== 'function' && typeof type !== 'string') {
174
- var info = '';
175
- 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 ' + "it's defined in.";
177
- }
180
+ var info = '';
181
+ if (type === undefined || typeof type === 'object' && type !== null && Object.keys(type).length === 0) {
182
+ info += ' You likely forgot to export your component from the file ' + 'it\'s defined in.';
183
+ }
178
184
 
179
- var sourceInfo = getSourceInfoErrorAddendum(props);
180
- if (sourceInfo) {
181
- info += sourceInfo;
182
- } else {
183
- info += getDeclarationErrorAddendum();
184
- }
185
+ var sourceInfo = getSourceInfoErrorAddendum(props);
186
+ if (sourceInfo) {
187
+ info += sourceInfo;
188
+ } else {
189
+ info += getDeclarationErrorAddendum();
190
+ }
185
191
 
186
- info += ReactComponentTreeHook.getCurrentStackAddendum();
192
+ info += ReactComponentTreeHook.getCurrentStackAddendum();
187
193
 
188
- var currentSource = props !== null && props !== undefined && props.__source !== undefined ? props.__source : null;
189
- ReactComponentTreeHook.pushNonStandardWarningStack(true, currentSource);
190
- 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
- }
194
+ 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;
193
195
  }
194
196
 
195
197
  var element = ReactElement.createElement.apply(this, arguments);
@@ -200,6 +202,10 @@ var ReactElementValidator = {
200
202
  return element;
201
203
  }
202
204
 
205
+ if (process.env.NODE_ENV !== 'production') {
206
+ ReactDebugCurrentFrame.element = element;
207
+ }
208
+
203
209
  // Skip key warning if the type isn't valid since our key validation logic
204
210
  // doesn't expect a non-string/function type and can throw confusing errors.
205
211
  // We don't want exception behavior to differ between dev and prod.
@@ -213,6 +219,10 @@ var ReactElementValidator = {
213
219
 
214
220
  validatePropTypes(element);
215
221
 
222
+ if (process.env.NODE_ENV !== 'production') {
223
+ ReactDebugCurrentFrame.element = null;
224
+ }
225
+
216
226
  return element;
217
227
  },
218
228
 
@@ -226,7 +236,7 @@ var ReactElementValidator = {
226
236
  Object.defineProperty(validatedFactory, 'type', {
227
237
  enumerable: false,
228
238
  get: function () {
229
- lowPriorityWarning(false, 'Factory.type is deprecated. Access the class directly ' + 'before passing it to createFactory.');
239
+ process.env.NODE_ENV !== 'production' ? warning(false, 'Factory.type is deprecated. Access the class directly ' + 'before passing it to createFactory.') : void 0;
230
240
  Object.defineProperty(this, 'type', {
231
241
  value: type
232
242
  });
@@ -241,12 +251,19 @@ var ReactElementValidator = {
241
251
 
242
252
  cloneElement: function (element, props, children) {
243
253
  var newElement = ReactElement.cloneElement.apply(this, arguments);
254
+ if (process.env.NODE_ENV !== 'production') {
255
+ ReactDebugCurrentFrame.element = newElement;
256
+ }
244
257
  for (var i = 2; i < arguments.length; i++) {
245
258
  validateChildKeys(arguments[i], newElement.type);
246
259
  }
247
260
  validatePropTypes(newElement);
261
+ if (process.env.NODE_ENV !== 'production') {
262
+ ReactDebugCurrentFrame.element = null;
263
+ }
248
264
  return newElement;
249
265
  }
266
+
250
267
  };
251
268
 
252
269
  module.exports = ReactElementValidator;