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.
+30 −16
Diff settings

Always

Just for now

Viewing a subset of changes. View all

Convert react-test-renderer package to ES Modules

  • Loading branch information...
gaearon committed Oct 27, 2017
commit e0bd5720e055c0718fd7c28151beb925787501b6
@@ -9,4 +9,10 @@
'use strict';
module.exports = require('./src/ReactTestRenderer');
var ReactTestRenderer = require('./src/ReactTestRenderer');
// TODO: decide on the top-level export form.
// This is hacky but makes it work with both Rollup and Jest.
module.exports = ReactTestRenderer.default
? ReactTestRenderer.default
: ReactTestRenderer;
@@ -9,4 +9,10 @@
'use strict';
module.exports = require('./src/ReactShallowRenderer');
var ReactShallowRenderer = require('./src/ReactShallowRenderer');
// TODO: decide on the top-level export form.
// This is hacky but makes it work with both Rollup and Jest.
module.exports = ReactShallowRenderer.default
? ReactShallowRenderer.default
: ReactShallowRenderer;
@@ -8,12 +8,12 @@
'use strict';
const React = require('react');
const describeComponentFrame = require('shared/describeComponentFrame');
const getComponentName = require('shared/getComponentName');
const emptyObject = require('fbjs/lib/emptyObject');
const invariant = require('fbjs/lib/invariant');
const checkPropTypes = require('prop-types/checkPropTypes');
import React from 'react';
import describeComponentFrame from 'shared/describeComponentFrame';
import getComponentName from 'shared/getComponentName';
import emptyObject from 'fbjs/lib/emptyObject';
import invariant from 'fbjs/lib/invariant';
import checkPropTypes from 'prop-types/checkPropTypes';
class ReactShallowRenderer {
static createRenderer = function() {
@@ -267,4 +267,4 @@ function shouldConstruct(Component) {
return !!(Component.prototype && Component.prototype.isReactComponent);
}
module.exports = ReactShallowRenderer;
export default ReactShallowRenderer;
@@ -12,12 +12,14 @@
import type {Fiber} from 'react-reconciler/src/ReactFiber';
import type {FiberRoot} from 'react-reconciler/src/ReactFiberRoot';
var ReactFiberReconciler = require('react-reconciler');
var ReactGenericBatching = require('events/ReactGenericBatching');
var ReactFiberTreeReflection = require('shared/ReactFiberTreeReflection');
var emptyObject = require('fbjs/lib/emptyObject');
var ReactTypeOfWork = require('shared/ReactTypeOfWork');
var invariant = require('fbjs/lib/invariant');
import ReactFiberReconciler from 'react-reconciler';
import ReactGenericBatching from 'events/ReactGenericBatching';
import ReactFiberTreeReflection from 'shared/ReactFiberTreeReflection';
import emptyObject from 'fbjs/lib/emptyObject';
import ReactTypeOfWork from 'shared/ReactTypeOfWork';
import invariant from 'fbjs/lib/invariant';
// TODO: make a named import after reconciler is converted.
var {
Fragment,
FunctionalComponent,
@@ -642,4 +644,4 @@ var ReactTestRendererFiber = {
/* eslint-enable camelcase */
};
module.exports = ReactTestRendererFiber;
export default ReactTestRendererFiber;
ProTip! Use n and p to navigate between commits in a pull request.