react 15.0.2 → 15.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/react-with-addons.js +1545 -918
- package/dist/react-with-addons.min.js +6 -6
- package/dist/react.js +1515 -1339
- package/dist/react.min.js +6 -6
- package/lib/CSSPropertyOperations.js +5 -5
- package/lib/DOMChildrenOperations.js +41 -6
- package/lib/DOMLazyTree.js +15 -3
- package/lib/DOMPropertyOperations.js +22 -13
- package/lib/LinkedStateMixin.js +1 -0
- package/lib/ReactCSSTransitionGroup.js +5 -0
- package/lib/ReactChildren.js +9 -1
- package/lib/ReactClass.js +1 -0
- package/lib/ReactComponentBrowserEnvironment.js +0 -5
- package/lib/ReactComponentTreeDevtool.js +145 -0
- package/lib/ReactComponentWithPureRenderMixin.js +2 -0
- package/lib/ReactCompositeComponent.js +147 -18
- package/lib/ReactDOM.js +1 -4
- package/lib/ReactDOMComponent.js +51 -11
- package/lib/ReactDOMIDOperations.js +0 -5
- package/lib/ReactDOMInput.js +5 -3
- package/lib/ReactDOMTextComponent.js +7 -6
- package/lib/ReactDebugTool.js +188 -10
- package/lib/ReactDefaultInjection.js +0 -9
- package/lib/ReactElement.js +26 -0
- package/lib/ReactFragment.js +5 -2
- package/lib/ReactInjection.js +0 -2
- package/lib/ReactLink.js +3 -0
- package/lib/ReactMount.js +22 -7
- package/lib/ReactMultiChild.js +21 -0
- package/lib/ReactNativeAttributePayload.js +7 -36
- package/lib/{IOSNativeBridgeEventPlugin.js → ReactNativeBridgeEventPlugin.js} +8 -5
- package/lib/ReactNativeDOMIDOperations.js +3 -6
- package/lib/ReactNativeDefaultInjection.js +15 -12
- package/lib/ReactNativeEventEmitter.js +6 -3
- package/lib/{IOSDefaultEventPluginOrder.js → ReactNativeEventPluginOrder.js} +3 -3
- package/lib/ReactNativeMount.js +24 -7
- package/lib/ReactNativeOperationHistoryDevtool.js +37 -0
- package/lib/ReactNativeTextComponent.js +8 -0
- package/lib/ReactPerf.js +397 -75
- package/lib/ReactReconciler.js +46 -5
- package/lib/ReactServerRendering.js +20 -1
- package/lib/ReactServerRenderingTransaction.js +5 -1
- package/lib/ReactTestUtils.js +8 -0
- package/lib/ReactTransitionGroup.js +5 -0
- package/lib/ReactUpdates.js +21 -3
- package/lib/ReactVersion.js +1 -1
- package/lib/ReactWithAddons.js +1 -1
- package/lib/findDOMNode.js +2 -0
- package/lib/instantiateReactComponent.js +34 -1
- package/lib/onlyChild.js +7 -4
- package/lib/shallowCompare.js +1 -0
- package/lib/update.js +4 -0
- package/package.json +2 -2
- package/lib/ReactDebugInstanceMap.js +0 -102
- package/lib/ReactDefaultPerf.js +0 -316
- package/lib/ReactDefaultPerfAnalysis.js +0 -210
package/lib/ReactReconciler.js
CHANGED
|
@@ -14,6 +14,8 @@
|
|
|
14
14
|
var ReactRef = require('./ReactRef');
|
|
15
15
|
var ReactInstrumentation = require('./ReactInstrumentation');
|
|
16
16
|
|
|
17
|
+
var invariant = require('fbjs/lib/invariant');
|
|
18
|
+
|
|
17
19
|
/**
|
|
18
20
|
* Helper to call ReactRef.attachRefs with this composite component, split out
|
|
19
21
|
* to avoid allocations in the transaction mount-ready queue.
|
|
@@ -36,12 +38,20 @@ var ReactReconciler = {
|
|
|
36
38
|
* @internal
|
|
37
39
|
*/
|
|
38
40
|
mountComponent: function (internalInstance, transaction, nativeParent, nativeContainerInfo, context) {
|
|
41
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
42
|
+
if (internalInstance._debugID !== 0) {
|
|
43
|
+
ReactInstrumentation.debugTool.onBeginReconcilerTimer(internalInstance._debugID, 'mountComponent');
|
|
44
|
+
}
|
|
45
|
+
}
|
|
39
46
|
var markup = internalInstance.mountComponent(transaction, nativeParent, nativeContainerInfo, context);
|
|
40
47
|
if (internalInstance._currentElement && internalInstance._currentElement.ref != null) {
|
|
41
48
|
transaction.getReactMountReady().enqueue(attachRefs, internalInstance);
|
|
42
49
|
}
|
|
43
50
|
if (process.env.NODE_ENV !== 'production') {
|
|
44
|
-
|
|
51
|
+
if (internalInstance._debugID !== 0) {
|
|
52
|
+
ReactInstrumentation.debugTool.onEndReconcilerTimer(internalInstance._debugID, 'mountComponent');
|
|
53
|
+
ReactInstrumentation.debugTool.onMountComponent(internalInstance._debugID);
|
|
54
|
+
}
|
|
45
55
|
}
|
|
46
56
|
return markup;
|
|
47
57
|
},
|
|
@@ -61,10 +71,18 @@ var ReactReconciler = {
|
|
|
61
71
|
* @internal
|
|
62
72
|
*/
|
|
63
73
|
unmountComponent: function (internalInstance, safely) {
|
|
74
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
75
|
+
if (internalInstance._debugID !== 0) {
|
|
76
|
+
ReactInstrumentation.debugTool.onBeginReconcilerTimer(internalInstance._debugID, 'unmountComponent');
|
|
77
|
+
}
|
|
78
|
+
}
|
|
64
79
|
ReactRef.detachRefs(internalInstance, internalInstance._currentElement);
|
|
65
80
|
internalInstance.unmountComponent(safely);
|
|
66
81
|
if (process.env.NODE_ENV !== 'production') {
|
|
67
|
-
|
|
82
|
+
if (internalInstance._debugID !== 0) {
|
|
83
|
+
ReactInstrumentation.debugTool.onEndReconcilerTimer(internalInstance._debugID, 'unmountComponent');
|
|
84
|
+
ReactInstrumentation.debugTool.onUnmountComponent(internalInstance._debugID);
|
|
85
|
+
}
|
|
68
86
|
}
|
|
69
87
|
},
|
|
70
88
|
|
|
@@ -94,6 +112,12 @@ var ReactReconciler = {
|
|
|
94
112
|
return;
|
|
95
113
|
}
|
|
96
114
|
|
|
115
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
116
|
+
if (internalInstance._debugID !== 0) {
|
|
117
|
+
ReactInstrumentation.debugTool.onBeginReconcilerTimer(internalInstance._debugID, 'receiveComponent');
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
|
|
97
121
|
var refsChanged = ReactRef.shouldUpdateRefs(prevElement, nextElement);
|
|
98
122
|
|
|
99
123
|
if (refsChanged) {
|
|
@@ -107,7 +131,10 @@ var ReactReconciler = {
|
|
|
107
131
|
}
|
|
108
132
|
|
|
109
133
|
if (process.env.NODE_ENV !== 'production') {
|
|
110
|
-
|
|
134
|
+
if (internalInstance._debugID !== 0) {
|
|
135
|
+
ReactInstrumentation.debugTool.onEndReconcilerTimer(internalInstance._debugID, 'receiveComponent');
|
|
136
|
+
ReactInstrumentation.debugTool.onUpdateComponent(internalInstance._debugID);
|
|
137
|
+
}
|
|
111
138
|
}
|
|
112
139
|
},
|
|
113
140
|
|
|
@@ -118,10 +145,24 @@ var ReactReconciler = {
|
|
|
118
145
|
* @param {ReactReconcileTransaction} transaction
|
|
119
146
|
* @internal
|
|
120
147
|
*/
|
|
121
|
-
performUpdateIfNecessary: function (internalInstance, transaction) {
|
|
148
|
+
performUpdateIfNecessary: function (internalInstance, transaction, updateBatchNumber) {
|
|
149
|
+
if (internalInstance._updateBatchNumber !== updateBatchNumber) {
|
|
150
|
+
// The component's enqueued batch number should always be the current
|
|
151
|
+
// batch or the following one.
|
|
152
|
+
!(internalInstance._updateBatchNumber == null || internalInstance._updateBatchNumber === updateBatchNumber + 1) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'performUpdateIfNecessary: Unexpected batch number (current %s, ' + 'pending %s)', updateBatchNumber, internalInstance._updateBatchNumber) : invariant(false) : void 0;
|
|
153
|
+
return;
|
|
154
|
+
}
|
|
155
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
156
|
+
if (internalInstance._debugID !== 0) {
|
|
157
|
+
ReactInstrumentation.debugTool.onBeginReconcilerTimer(internalInstance._debugID, 'performUpdateIfNecessary');
|
|
158
|
+
}
|
|
159
|
+
}
|
|
122
160
|
internalInstance.performUpdateIfNecessary(transaction);
|
|
123
161
|
if (process.env.NODE_ENV !== 'production') {
|
|
124
|
-
|
|
162
|
+
if (internalInstance._debugID !== 0) {
|
|
163
|
+
ReactInstrumentation.debugTool.onEndReconcilerTimer(internalInstance._debugID, 'performUpdateIfNecessary');
|
|
164
|
+
ReactInstrumentation.debugTool.onUpdateComponent(internalInstance._debugID);
|
|
165
|
+
}
|
|
125
166
|
}
|
|
126
167
|
}
|
|
127
168
|
|
|
@@ -13,7 +13,9 @@
|
|
|
13
13
|
var ReactDOMContainerInfo = require('./ReactDOMContainerInfo');
|
|
14
14
|
var ReactDefaultBatchingStrategy = require('./ReactDefaultBatchingStrategy');
|
|
15
15
|
var ReactElement = require('./ReactElement');
|
|
16
|
+
var ReactInstrumentation = require('./ReactInstrumentation');
|
|
16
17
|
var ReactMarkupChecksum = require('./ReactMarkupChecksum');
|
|
18
|
+
var ReactReconciler = require('./ReactReconciler');
|
|
17
19
|
var ReactServerBatchingStrategy = require('./ReactServerBatchingStrategy');
|
|
18
20
|
var ReactServerRenderingTransaction = require('./ReactServerRenderingTransaction');
|
|
19
21
|
var ReactUpdates = require('./ReactUpdates');
|
|
@@ -34,8 +36,15 @@ function renderToStringImpl(element, makeStaticMarkup) {
|
|
|
34
36
|
transaction = ReactServerRenderingTransaction.getPooled(makeStaticMarkup);
|
|
35
37
|
|
|
36
38
|
return transaction.perform(function () {
|
|
39
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
40
|
+
ReactInstrumentation.debugTool.onBeginFlush();
|
|
41
|
+
}
|
|
37
42
|
var componentInstance = instantiateReactComponent(element);
|
|
38
|
-
var markup =
|
|
43
|
+
var markup = ReactReconciler.mountComponent(componentInstance, transaction, null, ReactDOMContainerInfo(), emptyObject);
|
|
44
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
45
|
+
ReactInstrumentation.debugTool.onUnmountComponent(componentInstance._debugID);
|
|
46
|
+
ReactInstrumentation.debugTool.onEndFlush();
|
|
47
|
+
}
|
|
39
48
|
if (!makeStaticMarkup) {
|
|
40
49
|
markup = ReactMarkupChecksum.addChecksumToMarkup(markup);
|
|
41
50
|
}
|
|
@@ -49,11 +58,21 @@ function renderToStringImpl(element, makeStaticMarkup) {
|
|
|
49
58
|
}
|
|
50
59
|
}
|
|
51
60
|
|
|
61
|
+
/**
|
|
62
|
+
* Render a ReactElement to its initial HTML. This should only be used on the
|
|
63
|
+
* server.
|
|
64
|
+
* See https://facebook.github.io/react/docs/top-level-api.html#reactdomserver.rendertostring
|
|
65
|
+
*/
|
|
52
66
|
function renderToString(element) {
|
|
53
67
|
!ReactElement.isValidElement(element) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'renderToString(): You must pass a valid ReactElement.') : invariant(false) : void 0;
|
|
54
68
|
return renderToStringImpl(element, false);
|
|
55
69
|
}
|
|
56
70
|
|
|
71
|
+
/**
|
|
72
|
+
* Similar to renderToString, except this doesn't create extra DOM attributes
|
|
73
|
+
* such as data-react-id that React uses internally.
|
|
74
|
+
* See https://facebook.github.io/react/docs/top-level-api.html#reactdomserver.rendertostaticmarkup
|
|
75
|
+
*/
|
|
57
76
|
function renderToStaticMarkup(element) {
|
|
58
77
|
!ReactElement.isValidElement(element) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'renderToStaticMarkup(): You must pass a valid ReactElement.') : invariant(false) : void 0;
|
|
59
78
|
return renderToStringImpl(element, true);
|
|
@@ -59,7 +59,11 @@ var Mixin = {
|
|
|
59
59
|
* `PooledClass` looks for this, and will invoke this before allowing this
|
|
60
60
|
* instance to be reused.
|
|
61
61
|
*/
|
|
62
|
-
destructor: function () {}
|
|
62
|
+
destructor: function () {},
|
|
63
|
+
|
|
64
|
+
checkpoint: function () {},
|
|
65
|
+
|
|
66
|
+
rollback: function () {}
|
|
63
67
|
};
|
|
64
68
|
|
|
65
69
|
_assign(ReactServerRenderingTransaction.prototype, Transaction.Mixin, Mixin);
|
package/lib/ReactTestUtils.js
CHANGED
|
@@ -63,6 +63,10 @@ function findAllInRenderedTreeInternal(inst, test) {
|
|
|
63
63
|
}
|
|
64
64
|
|
|
65
65
|
/**
|
|
66
|
+
* Utilities for making it easy to test React components.
|
|
67
|
+
*
|
|
68
|
+
* See https://facebook.github.io/react/docs/test-utils.html
|
|
69
|
+
*
|
|
66
70
|
* Todo: Support the entire DOM.scry query syntax. For now, these simple
|
|
67
71
|
* utilities will suffice for testing purposes.
|
|
68
72
|
* @lends ReactTestUtils
|
|
@@ -307,9 +311,12 @@ ReactShallowRenderer.prototype.getMountedInstance = function () {
|
|
|
307
311
|
return this._instance ? this._instance._instance : null;
|
|
308
312
|
};
|
|
309
313
|
|
|
314
|
+
var nextDebugID = 1;
|
|
315
|
+
|
|
310
316
|
var NoopInternalComponent = function (element) {
|
|
311
317
|
this._renderedOutput = element;
|
|
312
318
|
this._currentElement = element;
|
|
319
|
+
this._debugID = nextDebugID++;
|
|
313
320
|
};
|
|
314
321
|
|
|
315
322
|
NoopInternalComponent.prototype = {
|
|
@@ -333,6 +340,7 @@ NoopInternalComponent.prototype = {
|
|
|
333
340
|
};
|
|
334
341
|
|
|
335
342
|
var ShallowComponentWrapper = function (element) {
|
|
343
|
+
this._debugID = nextDebugID++;
|
|
336
344
|
this.construct(element);
|
|
337
345
|
};
|
|
338
346
|
_assign(ShallowComponentWrapper.prototype, ReactCompositeComponent.Mixin, {
|
|
@@ -18,6 +18,11 @@ var ReactTransitionChildMapping = require('./ReactTransitionChildMapping');
|
|
|
18
18
|
|
|
19
19
|
var emptyFunction = require('fbjs/lib/emptyFunction');
|
|
20
20
|
|
|
21
|
+
/**
|
|
22
|
+
* A basis for animatins. When children are declaratively added or removed,
|
|
23
|
+
* special lifecycle hooks are called.
|
|
24
|
+
* See https://facebook.github.io/react/docs/animation.html#low-level-api-reacttransitiongroup
|
|
25
|
+
*/
|
|
21
26
|
var ReactTransitionGroup = React.createClass({
|
|
22
27
|
displayName: 'ReactTransitionGroup',
|
|
23
28
|
|
package/lib/ReactUpdates.js
CHANGED
|
@@ -16,13 +16,14 @@ var _assign = require('object-assign');
|
|
|
16
16
|
var CallbackQueue = require('./CallbackQueue');
|
|
17
17
|
var PooledClass = require('./PooledClass');
|
|
18
18
|
var ReactFeatureFlags = require('./ReactFeatureFlags');
|
|
19
|
-
var
|
|
19
|
+
var ReactInstrumentation = require('./ReactInstrumentation');
|
|
20
20
|
var ReactReconciler = require('./ReactReconciler');
|
|
21
21
|
var Transaction = require('./Transaction');
|
|
22
22
|
|
|
23
23
|
var invariant = require('fbjs/lib/invariant');
|
|
24
24
|
|
|
25
25
|
var dirtyComponents = [];
|
|
26
|
+
var updateBatchNumber = 0;
|
|
26
27
|
var asapCallbackQueue = CallbackQueue.getPooled();
|
|
27
28
|
var asapEnqueued = false;
|
|
28
29
|
|
|
@@ -117,6 +118,13 @@ function runBatchedUpdates(transaction) {
|
|
|
117
118
|
// them before their children by sorting the array.
|
|
118
119
|
dirtyComponents.sort(mountOrderComparator);
|
|
119
120
|
|
|
121
|
+
// Any updates enqueued while reconciling must be performed after this entire
|
|
122
|
+
// batch. Otherwise, if dirtyComponents is [A, B] where A has children B and
|
|
123
|
+
// C, B could update twice in a single batch if C's render enqueues an update
|
|
124
|
+
// to B (since B would have already updated, we should skip it, and the only
|
|
125
|
+
// way we can know to do so is by checking the batch counter).
|
|
126
|
+
updateBatchNumber++;
|
|
127
|
+
|
|
120
128
|
for (var i = 0; i < len; i++) {
|
|
121
129
|
// If a component is unmounted before pending changes apply, it will still
|
|
122
130
|
// be here, but we assume that it has cleared its _pendingCallbacks and
|
|
@@ -140,7 +148,7 @@ function runBatchedUpdates(transaction) {
|
|
|
140
148
|
console.time(markerName);
|
|
141
149
|
}
|
|
142
150
|
|
|
143
|
-
ReactReconciler.performUpdateIfNecessary(component, transaction.reconcileTransaction);
|
|
151
|
+
ReactReconciler.performUpdateIfNecessary(component, transaction.reconcileTransaction, updateBatchNumber);
|
|
144
152
|
|
|
145
153
|
if (markerName) {
|
|
146
154
|
console.timeEnd(markerName);
|
|
@@ -155,6 +163,10 @@ function runBatchedUpdates(transaction) {
|
|
|
155
163
|
}
|
|
156
164
|
|
|
157
165
|
var flushBatchedUpdates = function () {
|
|
166
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
167
|
+
ReactInstrumentation.debugTool.onBeginFlush();
|
|
168
|
+
}
|
|
169
|
+
|
|
158
170
|
// ReactUpdatesFlushTransaction's wrappers will clear the dirtyComponents
|
|
159
171
|
// array and perform any updates enqueued by mount-ready handlers (i.e.,
|
|
160
172
|
// componentDidUpdate) but we need to check here too in order to catch
|
|
@@ -174,8 +186,11 @@ var flushBatchedUpdates = function () {
|
|
|
174
186
|
CallbackQueue.release(queue);
|
|
175
187
|
}
|
|
176
188
|
}
|
|
189
|
+
|
|
190
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
191
|
+
ReactInstrumentation.debugTool.onEndFlush();
|
|
192
|
+
}
|
|
177
193
|
};
|
|
178
|
-
flushBatchedUpdates = ReactPerf.measure('ReactUpdates', 'flushBatchedUpdates', flushBatchedUpdates);
|
|
179
194
|
|
|
180
195
|
/**
|
|
181
196
|
* Mark a component as needing a rerender, adding an optional callback to a
|
|
@@ -196,6 +211,9 @@ function enqueueUpdate(component) {
|
|
|
196
211
|
}
|
|
197
212
|
|
|
198
213
|
dirtyComponents.push(component);
|
|
214
|
+
if (component._updateBatchNumber == null) {
|
|
215
|
+
component._updateBatchNumber = updateBatchNumber + 1;
|
|
216
|
+
}
|
|
199
217
|
}
|
|
200
218
|
|
|
201
219
|
/**
|
package/lib/ReactVersion.js
CHANGED
package/lib/ReactWithAddons.js
CHANGED
package/lib/findDOMNode.js
CHANGED
|
@@ -22,6 +22,8 @@ var warning = require('fbjs/lib/warning');
|
|
|
22
22
|
/**
|
|
23
23
|
* Returns the DOM node rendered by this element.
|
|
24
24
|
*
|
|
25
|
+
* See https://facebook.github.io/react/docs/top-level-api.html#reactdom.finddomnode
|
|
26
|
+
*
|
|
25
27
|
* @param {ReactComponent|DOMElement} componentOrElement
|
|
26
28
|
* @return {?DOMElement} The root node of this element.
|
|
27
29
|
*/
|
|
@@ -16,6 +16,7 @@ var _assign = require('object-assign');
|
|
|
16
16
|
var ReactCompositeComponent = require('./ReactCompositeComponent');
|
|
17
17
|
var ReactEmptyComponent = require('./ReactEmptyComponent');
|
|
18
18
|
var ReactNativeComponent = require('./ReactNativeComponent');
|
|
19
|
+
var ReactInstrumentation = require('./ReactInstrumentation');
|
|
19
20
|
|
|
20
21
|
var invariant = require('fbjs/lib/invariant');
|
|
21
22
|
var warning = require('fbjs/lib/warning');
|
|
@@ -38,6 +39,21 @@ function getDeclarationErrorAddendum(owner) {
|
|
|
38
39
|
return '';
|
|
39
40
|
}
|
|
40
41
|
|
|
42
|
+
function getDisplayName(instance) {
|
|
43
|
+
var element = instance._currentElement;
|
|
44
|
+
if (element == null) {
|
|
45
|
+
return '#empty';
|
|
46
|
+
} else if (typeof element === 'string' || typeof element === 'number') {
|
|
47
|
+
return '#text';
|
|
48
|
+
} else if (typeof element.type === 'string') {
|
|
49
|
+
return element.type;
|
|
50
|
+
} else if (instance.getName) {
|
|
51
|
+
return instance.getName() || 'Unknown';
|
|
52
|
+
} else {
|
|
53
|
+
return element.type.displayName || element.type.name || 'Unknown';
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
41
57
|
/**
|
|
42
58
|
* Check if the type reference is a known internal type. I.e. not a user
|
|
43
59
|
* provided composite type.
|
|
@@ -49,6 +65,8 @@ function isInternalComponentType(type) {
|
|
|
49
65
|
return typeof type === 'function' && typeof type.prototype !== 'undefined' && typeof type.prototype.mountComponent === 'function' && typeof type.prototype.receiveComponent === 'function';
|
|
50
66
|
}
|
|
51
67
|
|
|
68
|
+
var nextDebugID = 1;
|
|
69
|
+
|
|
52
70
|
/**
|
|
53
71
|
* Given a ReactNode, create an instance that will actually be mounted.
|
|
54
72
|
*
|
|
@@ -59,7 +77,8 @@ function isInternalComponentType(type) {
|
|
|
59
77
|
function instantiateReactComponent(node) {
|
|
60
78
|
var instance;
|
|
61
79
|
|
|
62
|
-
|
|
80
|
+
var isEmpty = node === null || node === false;
|
|
81
|
+
if (isEmpty) {
|
|
63
82
|
instance = ReactEmptyComponent.create(instantiateReactComponent);
|
|
64
83
|
} else if (typeof node === 'object') {
|
|
65
84
|
var element = node;
|
|
@@ -97,6 +116,20 @@ function instantiateReactComponent(node) {
|
|
|
97
116
|
instance._warnedAboutRefsInRender = false;
|
|
98
117
|
}
|
|
99
118
|
|
|
119
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
120
|
+
var debugID = isEmpty ? 0 : nextDebugID++;
|
|
121
|
+
instance._debugID = debugID;
|
|
122
|
+
|
|
123
|
+
if (debugID !== 0) {
|
|
124
|
+
var displayName = getDisplayName(instance);
|
|
125
|
+
ReactInstrumentation.debugTool.onSetDisplayName(debugID, displayName);
|
|
126
|
+
var owner = node && node._owner;
|
|
127
|
+
if (owner) {
|
|
128
|
+
ReactInstrumentation.debugTool.onSetOwner(debugID, owner._debugID);
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
|
|
100
133
|
// Internal instances should fully constructed at this point, so they should
|
|
101
134
|
// not get any new fields added to them at this point.
|
|
102
135
|
if (process.env.NODE_ENV !== 'production') {
|
package/lib/onlyChild.js
CHANGED
|
@@ -16,10 +16,13 @@ var invariant = require('fbjs/lib/invariant');
|
|
|
16
16
|
|
|
17
17
|
/**
|
|
18
18
|
* Returns the first child in a collection of children and verifies that there
|
|
19
|
-
* is only one child in the collection.
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
19
|
+
* is only one child in the collection.
|
|
20
|
+
*
|
|
21
|
+
* See https://facebook.github.io/react/docs/top-level-api.html#react.children.only
|
|
22
|
+
*
|
|
23
|
+
* The current implementation of this function assumes that a single child gets
|
|
24
|
+
* passed without a wrapper, but the purpose of this helper function is to
|
|
25
|
+
* abstract away the particular structure of children.
|
|
23
26
|
*
|
|
24
27
|
* @param {?object} children Child collection structure.
|
|
25
28
|
* @return {ReactElement} The first and only `ReactElement` contained in the
|
package/lib/shallowCompare.js
CHANGED
|
@@ -16,6 +16,7 @@ var shallowEqual = require('fbjs/lib/shallowEqual');
|
|
|
16
16
|
/**
|
|
17
17
|
* Does a shallow comparison for props and state.
|
|
18
18
|
* See ReactComponentWithPureRenderMixin
|
|
19
|
+
* See also https://facebook.github.io/react/docs/shallow-compare.html
|
|
19
20
|
*/
|
|
20
21
|
function shallowCompare(instance, nextProps, nextState) {
|
|
21
22
|
return !shallowEqual(instance.props, nextProps) || !shallowEqual(instance.state, nextState);
|
package/lib/update.js
CHANGED
|
@@ -50,6 +50,10 @@ function invariantArrayCase(value, spec, command) {
|
|
|
50
50
|
!Array.isArray(specValue) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'update(): expected spec of %s to be an array; got %s. ' + 'Did you forget to wrap your parameter in an array?', command, specValue) : invariant(false) : void 0;
|
|
51
51
|
}
|
|
52
52
|
|
|
53
|
+
/**
|
|
54
|
+
* Returns a updated shallow copy of an object without mutating the original.
|
|
55
|
+
* See https://facebook.github.io/react/docs/update.html for details.
|
|
56
|
+
*/
|
|
53
57
|
function update(value, spec) {
|
|
54
58
|
!(typeof spec === 'object') ? process.env.NODE_ENV !== 'production' ? invariant(false, 'update(): You provided a key path to update() that did not contain one ' + 'of %s. Did you forget to include {%s: ...}?', ALL_COMMANDS_LIST.join(', '), COMMAND_SET) : invariant(false) : void 0;
|
|
55
59
|
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react",
|
|
3
3
|
"description": "React is a JavaScript library for building user interfaces.",
|
|
4
|
-
"version": "15.0
|
|
4
|
+
"version": "15.1.0",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react"
|
|
7
7
|
],
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"dependencies": {
|
|
26
26
|
"fbjs": "^0.8.0",
|
|
27
27
|
"loose-envify": "^1.1.0",
|
|
28
|
-
"object-assign": "^4.0
|
|
28
|
+
"object-assign": "^4.1.0"
|
|
29
29
|
},
|
|
30
30
|
"browserify": {
|
|
31
31
|
"transform": [
|
|
@@ -1,102 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright 2016-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
|
-
* @providesModule ReactDebugInstanceMap
|
|
10
|
-
*/
|
|
11
|
-
|
|
12
|
-
'use strict';
|
|
13
|
-
|
|
14
|
-
var warning = require('fbjs/lib/warning');
|
|
15
|
-
|
|
16
|
-
function checkValidInstance(internalInstance) {
|
|
17
|
-
if (!internalInstance) {
|
|
18
|
-
process.env.NODE_ENV !== 'production' ? warning(false, 'There is an internal error in the React developer tools integration. ' + 'Instead of an internal instance, received %s. ' + 'Please report this as a bug in React.', internalInstance) : void 0;
|
|
19
|
-
return false;
|
|
20
|
-
}
|
|
21
|
-
var isValid = typeof internalInstance.mountComponent === 'function';
|
|
22
|
-
process.env.NODE_ENV !== 'production' ? warning(isValid, 'There is an internal error in the React developer tools integration. ' + 'Instead of an internal instance, received an object with the following ' + 'keys: %s. Please report this as a bug in React.', Object.keys(internalInstance).join(', ')) : void 0;
|
|
23
|
-
return isValid;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
var idCounter = 1;
|
|
27
|
-
var instancesByIDs = {};
|
|
28
|
-
var instancesToIDs;
|
|
29
|
-
|
|
30
|
-
function getIDForInstance(internalInstance) {
|
|
31
|
-
if (!instancesToIDs) {
|
|
32
|
-
instancesToIDs = new WeakMap();
|
|
33
|
-
}
|
|
34
|
-
if (instancesToIDs.has(internalInstance)) {
|
|
35
|
-
return instancesToIDs.get(internalInstance);
|
|
36
|
-
} else {
|
|
37
|
-
var instanceID = (idCounter++).toString();
|
|
38
|
-
instancesToIDs.set(internalInstance, instanceID);
|
|
39
|
-
return instanceID;
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
function getInstanceByID(instanceID) {
|
|
44
|
-
return instancesByIDs[instanceID] || null;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
function isRegisteredInstance(internalInstance) {
|
|
48
|
-
var instanceID = getIDForInstance(internalInstance);
|
|
49
|
-
if (instanceID) {
|
|
50
|
-
return instancesByIDs.hasOwnProperty(instanceID);
|
|
51
|
-
} else {
|
|
52
|
-
return false;
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
function registerInstance(internalInstance) {
|
|
57
|
-
var instanceID = getIDForInstance(internalInstance);
|
|
58
|
-
if (instanceID) {
|
|
59
|
-
instancesByIDs[instanceID] = internalInstance;
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
function unregisterInstance(internalInstance) {
|
|
64
|
-
var instanceID = getIDForInstance(internalInstance);
|
|
65
|
-
if (instanceID) {
|
|
66
|
-
delete instancesByIDs[instanceID];
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
var ReactDebugInstanceMap = {
|
|
71
|
-
getIDForInstance: function (internalInstance) {
|
|
72
|
-
if (!checkValidInstance(internalInstance)) {
|
|
73
|
-
return null;
|
|
74
|
-
}
|
|
75
|
-
return getIDForInstance(internalInstance);
|
|
76
|
-
},
|
|
77
|
-
getInstanceByID: function (instanceID) {
|
|
78
|
-
return getInstanceByID(instanceID);
|
|
79
|
-
},
|
|
80
|
-
isRegisteredInstance: function (internalInstance) {
|
|
81
|
-
if (!checkValidInstance(internalInstance)) {
|
|
82
|
-
return false;
|
|
83
|
-
}
|
|
84
|
-
return isRegisteredInstance(internalInstance);
|
|
85
|
-
},
|
|
86
|
-
registerInstance: function (internalInstance) {
|
|
87
|
-
if (!checkValidInstance(internalInstance)) {
|
|
88
|
-
return;
|
|
89
|
-
}
|
|
90
|
-
process.env.NODE_ENV !== 'production' ? warning(!isRegisteredInstance(internalInstance), 'There is an internal error in the React developer tools integration. ' + 'A registered instance should not be registered again. ' + 'Please report this as a bug in React.') : void 0;
|
|
91
|
-
registerInstance(internalInstance);
|
|
92
|
-
},
|
|
93
|
-
unregisterInstance: function (internalInstance) {
|
|
94
|
-
if (!checkValidInstance(internalInstance)) {
|
|
95
|
-
return;
|
|
96
|
-
}
|
|
97
|
-
process.env.NODE_ENV !== 'production' ? warning(isRegisteredInstance(internalInstance), 'There is an internal error in the React developer tools integration. ' + 'An unregistered instance should not be unregistered again. ' + 'Please report this as a bug in React.') : void 0;
|
|
98
|
-
unregisterInstance(internalInstance);
|
|
99
|
-
}
|
|
100
|
-
};
|
|
101
|
-
|
|
102
|
-
module.exports = ReactDebugInstanceMap;
|