Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inline dev-only requires #7188

Merged
merged 2 commits into from
Jul 5, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions src/isomorphic/classic/types/checkReactTypeSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@

'use strict';

var ReactComponentTreeDevtool = require('ReactComponentTreeDevtool');
var ReactPropTypeLocationNames = require('ReactPropTypeLocationNames');

var invariant = require('invariant');
Expand Down Expand Up @@ -72,10 +71,13 @@ function checkReactTypeSpec(typeSpecs, values, location, componentName, element,

var componentStackInfo = '';

if (debugID !== null) {
componentStackInfo = ReactComponentTreeDevtool.getStackAddendumByID(debugID);
} else if (element !== null) {
componentStackInfo = ReactComponentTreeDevtool.getCurrentStackAddendum(element);
if (__DEV__) {
var ReactComponentTreeDevtool = require('ReactComponentTreeDevtool');
if (debugID !== null) {
componentStackInfo = ReactComponentTreeDevtool.getStackAddendumByID(debugID);
} else if (element !== null) {
componentStackInfo = ReactComponentTreeDevtool.getCurrentStackAddendum(element);
}
}

warning(
Expand Down
10 changes: 6 additions & 4 deletions src/renderers/dom/shared/ReactDOMDebugTool.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@

'use strict';

var ReactDOMNullInputValuePropDevtool = require('ReactDOMNullInputValuePropDevtool');
var ReactDOMUnknownPropertyDevtool = require('ReactDOMUnknownPropertyDevtool');
var ReactDebugTool = require('ReactDebugTool');

var warning = require('warning');
Expand Down Expand Up @@ -68,7 +66,11 @@ var ReactDOMDebugTool = {
},
};

ReactDOMDebugTool.addDevtool(ReactDOMUnknownPropertyDevtool);
ReactDOMDebugTool.addDevtool(ReactDOMNullInputValuePropDevtool);
if (__DEV__) {
var ReactDOMNullInputValuePropDevtool = require('ReactDOMNullInputValuePropDevtool');
var ReactDOMUnknownPropertyDevtool = require('ReactDOMUnknownPropertyDevtool');
ReactDOMDebugTool.addDevtool(ReactDOMUnknownPropertyDevtool);
ReactDOMDebugTool.addDevtool(ReactDOMNullInputValuePropDevtool);
}

module.exports = ReactDOMDebugTool;
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@

var ReactReconciler = require('ReactReconciler');

var ReactComponentTreeDevtool = require('ReactComponentTreeDevtool');
var instantiateReactComponent = require('instantiateReactComponent');
var KeyEscapeUtils = require('KeyEscapeUtils');
var shouldUpdateReactComponent = require('shouldUpdateReactComponent');
Expand All @@ -24,6 +23,7 @@ function instantiateChild(childInstances, child, name, selfDebugID) {
// We found a component instance.
var keyUnique = (childInstances[name] === undefined);
if (__DEV__) {
var ReactComponentTreeDevtool = require('ReactComponentTreeDevtool');
warning(
keyUnique,
'flattenChildren(...): Encountered two children with the same key, ' +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,12 @@ function testPropsSequence(sequence) {
describe('ReactMultiChildReconcile', function() {
beforeEach(function() {
jest.resetModuleRegistry();

React = require('React');
ReactDOM = require('ReactDOM');
ReactDOMComponentTree = require('ReactDOMComponentTree');
ReactInstanceMap = require('ReactInstanceMap');
mapObject = require('mapObject');
});

it('should reset internal state if removed then readded', function() {
Expand Down
9 changes: 8 additions & 1 deletion src/renderers/shared/stack/reconciler/__tests__/refs-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,10 @@ var expectClickLogsLengthToBe = function(instance, length) {
describe('reactiverefs', function() {
beforeEach(function() {
jest.resetModuleRegistry();

React = require('React');
ReactTestUtils = require('ReactTestUtils');
reactComponentExpect = require('reactComponentExpect');
});

/**
Expand Down Expand Up @@ -159,6 +163,10 @@ describe('reactiverefs', function() {
describe('ref swapping', function() {
beforeEach(function() {
jest.resetModuleRegistry();

React = require('React');
ReactTestUtils = require('ReactTestUtils');
reactComponentExpect = require('reactComponentExpect');
});

var RefHopsAround = React.createClass({
Expand Down Expand Up @@ -275,4 +283,3 @@ describe('ref swapping', function() {
__DEV__ = originalDev;
});
});

2 changes: 1 addition & 1 deletion src/shared/utils/flattenChildren.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@

'use strict';

var ReactComponentTreeDevtool = require('ReactComponentTreeDevtool');
var KeyEscapeUtils = require('KeyEscapeUtils');
var traverseAllChildren = require('traverseAllChildren');
var warning = require('warning');
Expand All @@ -34,6 +33,7 @@ function flattenSingleChildIntoContext(
const result = traverseContext;
const keyUnique = (result[name] === undefined);
if (__DEV__) {
var ReactComponentTreeDevtool = require('ReactComponentTreeDevtool');
warning(
keyUnique,
'flattenChildren(...): Encountered two children with the same key, ' +
Expand Down