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

Convert the Source to ES Modules #11389

Merged
merged 23 commits into from Nov 2, 2017
Commits
Jump to file or symbol
Failed to load files and symbols.
+1,888 −1,901
Diff settings

Always

Just for now

Viewing a subset of changes. View all

Convert react-dom/{client,events,test-utils} to ES modules

  • Loading branch information...
gaearon committed Oct 31, 2017
commit 78a0900c355d6d6c0d7bdff485a7b9b425d0abab
@@ -11,15 +11,16 @@ var ReactDOM = require('./src/client/ReactDOM');
Object.assign(ReactDOM.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED, {
// These are real internal dependencies that are trickier to remove:
ReactBrowserEventEmitter: require('./src/events/ReactBrowserEventEmitter'),
ReactBrowserEventEmitter: require('./src/events/ReactBrowserEventEmitter')
.default,
ReactErrorUtils: require('shared/ReactErrorUtils'),
// TODO: direct imports like some-package/src/* are bad. Fix me.
ReactFiberErrorLogger: require('react-reconciler/src/ReactFiberErrorLogger'),
ReactFiberTreeReflection: require('shared/ReactFiberTreeReflection'),
ReactDOMComponentTree: require('./src/client/ReactDOMComponentTree'),
ReactDOMComponentTree: require('./src/client/ReactDOMComponentTree').default,
ReactInstanceMap: require('shared/ReactInstanceMap'),
// Used by www msite:
TapEventPlugin: require('./src/events/TapEventPlugin'),
TapEventPlugin: require('./src/events/TapEventPlugin').default,
});
module.exports = ReactDOM;
Copy path View file
@@ -9,4 +9,8 @@
'use strict';
module.exports = require('./src/client/ReactDOM');
var ReactDOM = require('./src/client/ReactDOM');
// TODO: decide on the top-level export form.
// This is hacky but makes it work with both Rollup and Jest.
module.exports = ReactDOM.default ? ReactDOM.default : ReactDOM;
@@ -62,10 +62,11 @@ describe('ReactBrowserEventEmitter', () => {
EventPluginRegistry = require('events/EventPluginRegistry');
React = require('react');
ReactDOM = require('react-dom');
ReactDOMComponentTree = require('../client/ReactDOMComponentTree');
ReactBrowserEventEmitter = require('../events/ReactBrowserEventEmitter');
ReactDOMComponentTree = require('../client/ReactDOMComponentTree').default;
ReactBrowserEventEmitter = require('../events/ReactBrowserEventEmitter')
.default;
ReactTestUtils = require('react-dom/test-utils');
TapEventPlugin = require('../events/TapEventPlugin');
TapEventPlugin = require('../events/TapEventPlugin').default;
var container = document.createElement('div');
@@ -34,7 +34,7 @@ describe('ReactDOMComponentTree', () => {
React = require('react');
ReactDOM = require('react-dom');
// TODO: can we express this test with only public API?
ReactDOMComponentTree = require('../client/ReactDOMComponentTree');
ReactDOMComponentTree = require('../client/ReactDOMComponentTree').default;
ReactDOMServer = require('react-dom/server');
});
@@ -24,8 +24,8 @@ describe('ReactDOMEventListener', () => {
React = require('react');
ReactDOM = require('react-dom');
// TODO: can we express this test with only public API?
ReactDOMComponentTree = require('../client/ReactDOMComponentTree');
ReactDOMEventListener = require('../events/ReactDOMEventListener');
ReactDOMComponentTree = require('../client/ReactDOMComponentTree').default;
ReactDOMEventListener = require('../events/ReactDOMEventListener').default;
ReactTestUtils = require('react-dom/test-utils');
handleTopLevel = jest.fn();
@@ -11,7 +11,7 @@
var React = require('react');
// TODO: can we express this test with only public API?
var ReactDOMComponentTree = require('../client/ReactDOMComponentTree');
var ReactDOMComponentTree = require('../client/ReactDOMComponentTree').default;
var ReactTestUtils = require('react-dom/test-utils');
/**
@@ -136,7 +136,7 @@ describe('ReactContextValidator', () => {
jest.resetModules();
// TODO: can we express this test with only public API?
validateDOMNesting = require('../client/validateDOMNesting');
validateDOMNesting = require('../client/validateDOMNesting').default;
});
it('allows any tag with no context', () => {
Oops, something went wrong.
ProTip! Use n and p to navigate between commits in a pull request.