@samitouri / QOS-React / commits / 8ef00dbb7d

Bundle DOM renderers into their individual UMD bundles (#7164)

* Cut out isomorphic dependencies from the renderers These files reaches into isomorphic files. The ReactElement functions are exposed on the React object anyway so I can just use those instead. I also found some files that are not shared that should be in renderers shared. * Found a few more shared dependencies renderSubtreeIntoContainer is only used by the DOM renderer. It's not an addon. ReactClass isn't needed as a dependency since injection doesn't happen anymore. * Use a shim file to load addons' dependencies on DOM By replacing this intermediate file we can do the lazy loading without needing any lazy requires. This set up works with ES modules. We could also replace the globalShim thing with aliased files instead for consistency. * Bundle DOM renderers into their individual UMD bundles Instead of exposing the entire DOM renderer on the react.js package, I only expose CurrentOwner and ComponentTreeDevtool which are currently the only two modules that share __state__ with the renderers. Then I package each renderer in its own package. That could allow us to drop more server dependencies from the client package. It will also allow us to ship fiber as a separate renderer. Unminified DEV after before react.js 123kb 696kb react-with-addons.js 227kb 774kb react-dom.js 668kb 1kb react-dom-server.js 638kb 1kb Minified PROD after before react.min.js 24kb 154kb react-with-addons.min.js 37kb 166kb react-dom.min.js 149kb 1kb react-dom-server.min.js 144kb 1kb The total size for react.min.js + react-dom.min.js is +19kb larger because of the overlap between them right now. I'd like to see what an optimizing compiler can do to this. Some of that is fbjs stuff. There shouldn't need to be that much overlap so that's something we can hunt. We should keep isomorphic absolutely minimal so there's no reason for other React clones not to use it. There will be less overlap with Fiber. However, another strategy that we could do is package the isomorphic package into each renderer bundle and conditionally initialize it if it hasn't already been initialized. That way you only pay an overlap tax when there are two renderers on the page but not without it. It's also easier to just pull in one package. The downside is the versioning stuff that the separate npm package would solve. That applies to CDNs as well. ReactWithAddons is a bit weird because it is packaged into the isomorphic package but has a bunch of DOM dependencies. So we have to load them lazily since the DOM package gets initialized after.

Sebastian Markbåge committed Aug 9, 2016 at 12:39 UTC 8ef00dbb7de944da0e7b14438baffd37df01bf37
20 files changed +287 -140
Gruntfile.js
+24 -2
@@ -117,12 +117,31 @@ module.exports = function(grunt) {
117 'build-modules',
118 'browserify:addonsMin',
119 ]);
120 + grunt.registerTask('build:dom', [
121 + 'build-modules',
122 + 'version-check',
123 + 'browserify:dom',
124 + ]);
125 + grunt.registerTask('build:dom-min', [
126 + 'build-modules',
127 + 'version-check',
128 + 'browserify:domMin',
129 + ]);
130 + grunt.registerTask('build:dom-server', [
131 + 'build-modules',
132 + 'version-check',
133 + 'browserify:domServer',
134 + ]);
135 + grunt.registerTask('build:dom-server-min', [
136 + 'build-modules',
137 + 'version-check',
138 + 'browserify:domServerMin',
139 + ]);
140 grunt.registerTask('build:npm-react', [
141 'version-check',
142 'build-modules',
143 'npm-react:release',
144 ]);
125 - grunt.registerTask('build:react-dom', require('./grunt/tasks/react-dom'));
145
146 var jestTasks = require('./grunt/tasks/jest');
147 grunt.registerTask('jest:normal', jestTasks.normal);
@@ -141,7 +160,10 @@ module.exports = function(grunt) {
160 'browserify:addons',
161 'browserify:min',
162 'browserify:addonsMin',
144 - 'build:react-dom',
163 + 'browserify:dom',
164 + 'browserify:domMin',
165 + 'browserify:domServer',
166 + 'browserify:domServerMin',
167 'npm-react:release',
168 'npm-react:pack',
169 'npm-react-dom:release',
grunt/config/browserify.js
+90 -1
@@ -7,11 +7,30 @@ var grunt = require('grunt');
7 var UglifyJS = require('uglify-js');
8 var uglifyify = require('uglifyify');
9 var derequire = require('derequire');
10 +var aliasify = require('aliasify');
11 +var globalShim = require('browserify-global-shim');
12 var collapser = require('bundle-collapser/plugin');
13
14 var envifyDev = envify({NODE_ENV: process.env.NODE_ENV || 'development'});
15 var envifyProd = envify({NODE_ENV: process.env.NODE_ENV || 'production'});
16
17 +var SECRET_INTERNALS_NAME = 'React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED';
18 +
19 +var shimSharedModules = globalShim.configure({
20 + './ReactCurrentOwner': SECRET_INTERNALS_NAME + '.ReactCurrentOwner',
21 + './ReactComponentTreeHook': SECRET_INTERNALS_NAME + '.ReactComponentTreeHook',
22 + // All these methods are shared are exposed.
23 + './ReactElement': 'React',
24 + './ReactPropTypes': 'React.PropTypes',
25 + './ReactChildren': 'React.Children',
26 +});
27 +
28 +var shimDOMModules = aliasify.configure({
29 + 'aliases': {
30 + './ReactAddonsDOMDependencies': './build/modules/ReactAddonsDOMDependenciesUMDShim.js',
31 + },
32 +});
33 +
34 var SIMPLE_TEMPLATE =
35 grunt.file.read('./grunt/data/header-template-short.txt');
36
@@ -87,6 +106,7 @@ var addons = {
106 debug: false,
107 standalone: 'React',
108 packageName: 'React (with addons)',
109 + transforms: [shimDOMModules],
110 globalTransforms: [envifyDev],
111 plugins: [collapser],
112 after: [derequire, simpleBannerify],
@@ -100,7 +120,72 @@ var addonsMin = {
120 debug: false,
121 standalone: 'React',
122 packageName: 'React (with addons)',
103 - transforms: [envifyProd, uglifyify],
123 + transforms: [shimDOMModules, envifyProd, uglifyify],
124 + globalTransforms: [envifyProd],
125 + plugins: [collapser],
126 + // No need to derequire because the minifier will mangle
127 + // the "require" calls.
128 +
129 + after: [minify, bannerify],
130 +};
131 +
132 +// The DOM Builds
133 +var dom = {
134 + entries: [
135 + './build/modules/ReactDOMUMDEntry.js',
136 + ],
137 + outfile: './build/react-dom.js',
138 + debug: false,
139 + standalone: 'ReactDOM',
140 + // Apply as global transform so that we also envify fbjs and any other deps
141 + transforms: [shimSharedModules],
142 + globalTransforms: [envifyDev],
143 + plugins: [collapser],
144 + after: [derequire, simpleBannerify],
145 +};
146 +
147 +var domMin = {
148 + entries: [
149 + './build/modules/ReactDOMUMDEntry.js',
150 + ],
151 + outfile: './build/react-dom.min.js',
152 + debug: false,
153 + standalone: 'ReactDOM',
154 + // Envify twice. The first ensures that when we uglifyify, we have the right
155 + // conditions to exclude requires. The global transform runs on deps.
156 + transforms: [shimSharedModules, envifyProd, uglifyify],
157 + globalTransforms: [envifyProd],
158 + plugins: [collapser],
159 + // No need to derequire because the minifier will mangle
160 + // the "require" calls.
161 +
162 + after: [minify, bannerify],
163 +};
164 +
165 +var domServer = {
166 + entries: [
167 + './build/modules/ReactDOMServerUMDEntry.js',
168 + ],
169 + outfile: './build/react-dom-server.js',
170 + debug: false,
171 + standalone: 'ReactDOMServer',
172 + // Apply as global transform so that we also envify fbjs and any other deps
173 + transforms: [shimSharedModules],
174 + globalTransforms: [envifyDev],
175 + plugins: [collapser],
176 + after: [derequire, simpleBannerify],
177 +};
178 +
179 +var domServerMin = {
180 + entries: [
181 + './build/modules/ReactDOMServerUMDEntry.js',
182 + ],
183 + outfile: './build/react-dom-server.min.js',
184 + debug: false,
185 + standalone: 'ReactDOMServer',
186 + // Envify twice. The first ensures that when we uglifyify, we have the right
187 + // conditions to exclude requires. The global transform runs on deps.
188 + transforms: [shimSharedModules, envifyProd, uglifyify],
189 globalTransforms: [envifyProd],
190 plugins: [collapser],
191 // No need to derequire because the minifier will mangle
@@ -114,4 +199,8 @@ module.exports = {
199 min: min,
200 addons: addons,
201 addonsMin: addonsMin,
202 + dom: dom,
203 + domMin: domMin,
204 + domServer: domServer,
205 + domServerMin: domServerMin,
206 };
grunt/tasks/react-dom.js deleted
-30
@@ -1,30 +0,0 @@
1 -'use strict';
2 -
3 -var grunt = require('grunt');
4 -var UglifyJS = require('uglify-js');
5 -
6 -var LICENSE_TEMPLATE =
7 - grunt.file.read('./grunt/data/header-template-extended.txt');
8 -
9 -function build(name, filename) {
10 - var srcFile = `vendor/${filename}.js`;
11 - var destFile = `build/${filename}.js`;
12 - var destFileMin = `build/${filename}.min.js`;
13 - var templateData = {
14 - package: name,
15 - version: grunt.config.data.pkg.version,
16 - };
17 - var header = grunt.template.process(
18 - LICENSE_TEMPLATE,
19 - {data: templateData}
20 - );
21 - var src = grunt.file.read(srcFile);
22 - var srcMin = UglifyJS.minify(src, {fromString: true}).code;
23 - grunt.file.write(destFile, header + src);
24 - grunt.file.write(destFileMin, header + srcMin);
25 -}
26 -
27 -module.exports = function() {
28 - build('ReactDOM', 'react-dom');
29 - build('ReactDOMServer', 'react-dom-server');
30 -};
package.json
+2
@@ -3,6 +3,7 @@
3 "private": true,
4 "version": "16.0.0-alpha",
5 "devDependencies": {
6 + "aliasify": "^2.0.0",
7 "art": "^0.10.1",
8 "async": "^1.5.0",
9 "babel-cli": "^6.6.5",
@@ -33,6 +34,7 @@
34 "babel-traverse": "^6.9.0",
35 "babylon": "6.8.0",
36 "browserify": "^13.0.0",
37 + "browserify-global-shim": "^1.0.3",
38 "bundle-collapser": "^1.1.1",
39 "coffee-script": "^1.8.0",
40 "core-js": "^2.2.1",
src/addons/ReactAddonsDOMDependencies.js new
+36
@@ -0,0 +1,36 @@
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 + * @providesModule ReactAddonsDOMDependencies
10 + */
11 +
12 +'use strict';
13 +
14 +var ReactDOM = require('ReactDOM');
15 +var ReactInstanceMap = require('ReactInstanceMap');
16 +
17 +exports.getReactDOM = function() {
18 + return ReactDOM;
19 +};
20 +
21 +exports.getReactInstanceMap = function() {
22 + return ReactInstanceMap;
23 +};
24 +
25 +if (__DEV__) {
26 + var ReactPerf = require('ReactPerf');
27 + var ReactTestUtils = require('ReactTestUtils');
28 +
29 + exports.getReactPerf = function() {
30 + return ReactPerf;
31 + };
32 +
33 + exports.getReactTestUtils = function() {
34 + return ReactTestUtils;
35 + };
36 +}
src/addons/ReactWithAddons.js
+15 -2
@@ -13,6 +13,7 @@
13
14 var LinkedStateMixin = require('LinkedStateMixin');
15 var React = require('React');
16 +var ReactAddonsDOMDependencies = require('ReactAddonsDOMDependencies');
17 var ReactComponentWithPureRenderMixin =
18 require('ReactComponentWithPureRenderMixin');
19 var ReactCSSTransitionGroup = require('ReactCSSTransitionGroup');
@@ -34,8 +35,20 @@ React.addons = {
35 };
36
37 if (__DEV__) {
37 - React.addons.Perf = require('ReactPerf');
38 - React.addons.TestUtils = require('ReactTestUtils');
38 + // For the UMD build we get these lazily from the global since they're tied
39 + // to the DOM renderer and it hasn't loaded yet.
40 + Object.defineProperty(React.addons, 'Perf', {
41 + enumerable: true,
42 + get: function() {
43 + return ReactAddonsDOMDependencies.getReactPerf();
44 + },
45 + });
46 + Object.defineProperty(React.addons, 'TestUtils', {
47 + enumerable: true,
48 + get: function() {
49 + return ReactAddonsDOMDependencies.getReactTestUtils();
50 + },
51 + });
52 }
53
54 module.exports = React;
src/addons/transitions/ReactCSSTransitionGroupChild.js
+2 -2
@@ -12,7 +12,7 @@
12 'use strict';
13
14 var React = require('React');
15 -var ReactDOM = require('ReactDOM');
15 +var ReactAddonsDOMDependencies = require('ReactAddonsDOMDependencies');
16
17 var CSSCore = require('CSSCore');
18 var ReactTransitionEvents = require('ReactTransitionEvents');
@@ -54,7 +54,7 @@ var ReactCSSTransitionGroupChild = React.createClass({
54 },
55
56 transition: function(animationType, finishCallback, userSpecifiedDelay) {
57 - var node = ReactDOM.findDOMNode(this);
57 + var node = ReactAddonsDOMDependencies.getReactDOM().findDOMNode(this);
58
59 if (!node) {
60 if (finishCallback) {
src/addons/transitions/ReactTransitionGroup.js
+5 -5
@@ -12,7 +12,7 @@
12 'use strict';
13
14 var React = require('React');
15 -var ReactInstanceMap = require('ReactInstanceMap');
15 +var ReactAddonsDOMDependencies = require('ReactAddonsDOMDependencies');
16 var ReactTransitionChildMapping = require('ReactTransitionChildMapping');
17
18 var emptyFunction = require('emptyFunction');
@@ -64,7 +64,7 @@ var ReactTransitionGroup = React.createClass({
64 if (__DEV__) {
65 nextChildMapping = ReactTransitionChildMapping.getChildMapping(
66 nextProps.children,
67 - ReactInstanceMap.get(this)._debugID
67 + ReactAddonsDOMDependencies.getReactInstanceMap().get(this)._debugID
68 );
69 } else {
70 nextChildMapping = ReactTransitionChildMapping.getChildMapping(
@@ -137,7 +137,7 @@ var ReactTransitionGroup = React.createClass({
137 if (__DEV__) {
138 currentChildMapping = ReactTransitionChildMapping.getChildMapping(
139 this.props.children,
140 - ReactInstanceMap.get(this)._debugID
140 + ReactAddonsDOMDependencies.getReactInstanceMap().get(this)._debugID
141 );
142 } else {
143 currentChildMapping = ReactTransitionChildMapping.getChildMapping(
@@ -177,7 +177,7 @@ var ReactTransitionGroup = React.createClass({
177 if (__DEV__) {
178 currentChildMapping = ReactTransitionChildMapping.getChildMapping(
179 this.props.children,
180 - ReactInstanceMap.get(this)._debugID
180 + ReactAddonsDOMDependencies.getReactInstanceMap().get(this)._debugID
181 );
182 } else {
183 currentChildMapping = ReactTransitionChildMapping.getChildMapping(
@@ -218,7 +218,7 @@ var ReactTransitionGroup = React.createClass({
218 if (__DEV__) {
219 currentChildMapping = ReactTransitionChildMapping.getChildMapping(
220 this.props.children,
221 - ReactInstanceMap.get(this)._debugID
221 + ReactAddonsDOMDependencies.getReactInstanceMap().get(this)._debugID
222 );
223 } else {
224 currentChildMapping = ReactTransitionChildMapping.getChildMapping(
src/renderers/dom/client/ReactMount.js
+5 -11
@@ -100,7 +100,7 @@ function mountComponentIntoNode(
100 ) {
101 var markerName;
102 if (ReactFeatureFlags.logTopLevelRenders) {
103 - var wrappedElement = wrapperInstance._currentElement.props;
103 + var wrappedElement = wrapperInstance._currentElement.props.child;
104 var type = wrappedElement.type;
105 markerName = 'React mount: ' + (
106 typeof type === 'string' ? type :
@@ -235,8 +235,7 @@ if (__DEV__) {
235 TopLevelWrapper.displayName = 'TopLevelWrapper';
236 }
237 TopLevelWrapper.prototype.render = function() {
238 - // this.props is actually a ReactElement
239 - return this.props;
238 + return this.props.child;
239 };
240
241 /**
@@ -421,14 +420,9 @@ var ReactMount = {
420 'for your app.'
421 );
422
424 - var nextWrappedElement = ReactElement(
423 + var nextWrappedElement = ReactElement.createElement(
424 TopLevelWrapper,
426 - null,
427 - null,
428 - null,
429 - null,
430 - null,
431 - nextElement
425 + { child: nextElement }
426 );
427
428 var nextContext;
@@ -443,7 +437,7 @@ var ReactMount = {
437
438 if (prevComponent) {
439 var prevWrappedElement = prevComponent._currentElement;
446 - var prevElement = prevWrappedElement.props;
440 + var prevElement = prevWrappedElement.props.child;
441 if (shouldUpdateReactComponent(prevElement, nextElement)) {
442 var publicInst = prevComponent._renderedComponent.getPublicInstance();
443 var updatedCallback = callback && function() {
src/renderers/dom/client/renderSubtreeIntoContainer.js renamed
src/renderers/dom/shared/ReactInjection.js
-2
@@ -15,7 +15,6 @@ var DOMProperty = require('DOMProperty');
15 var EventPluginHub = require('EventPluginHub');
16 var EventPluginUtils = require('EventPluginUtils');
17 var ReactComponentEnvironment = require('ReactComponentEnvironment');
18 -var ReactClass = require('ReactClass');
18 var ReactEmptyComponent = require('ReactEmptyComponent');
19 var ReactBrowserEventEmitter = require('ReactBrowserEventEmitter');
20 var ReactHostComponent = require('ReactHostComponent');
@@ -23,7 +22,6 @@ var ReactUpdates = require('ReactUpdates');
22
23 var ReactInjection = {
24 Component: ReactComponentEnvironment.injection,
26 - Class: ReactClass.injection,
25 DOMProperty: DOMProperty.injection,
26 EmptyComponent: ReactEmptyComponent.injection,
27 EventPluginHub: EventPluginHub.injection,
src/renderers/shared/stack/reconciler/ReactCompositeComponent.js
+15 -10
@@ -18,10 +18,13 @@ var ReactErrorUtils = require('ReactErrorUtils');
18 var ReactInstanceMap = require('ReactInstanceMap');
19 var ReactInstrumentation = require('ReactInstrumentation');
20 var ReactNodeTypes = require('ReactNodeTypes');
21 -var ReactPropTypeLocations = require('ReactPropTypeLocations');
21 var ReactReconciler = require('ReactReconciler');
22
24 -var checkReactTypeSpec = require('checkReactTypeSpec');
23 +if (__DEV__) {
24 + var ReactPropTypeLocations = require('ReactPropTypeLocations');
25 + var checkReactTypeSpec = require('checkReactTypeSpec');
26 +}
27 +
28 var emptyObject = require('emptyObject');
29 var invariant = require('invariant');
30 var shallowEqual = require('shallowEqual');
@@ -729,14 +732,16 @@ var ReactCompositeComponentMixin = {
732 * @private
733 */
734 _checkContextTypes: function(typeSpecs, values, location) {
732 - checkReactTypeSpec(
733 - typeSpecs,
734 - values,
735 - location,
736 - this.getName(),
737 - null,
738 - this._debugID
739 - );
735 + if (__DEV__) {
736 + checkReactTypeSpec(
737 + typeSpecs,
738 + values,
739 + location,
740 + this.getName(),
741 + null,
742 + this._debugID
743 + );
744 + }
745 },
746
747 receiveComponent: function(nextElement, transaction, nextContext) {
src/renderers/shared/stack/reconciler/ReactUpdates.js
+1 -1
@@ -161,7 +161,7 @@ function runBatchedUpdates(transaction) {
161 var namedComponent = component;
162 // Duck type TopLevelWrapper. This is probably always true.
163 if (
164 - component._currentElement.props ===
164 + component._currentElement.props.child ===
165 component._renderedComponent._currentElement
166 ) {
167 namedComponent = component._renderedComponent;
src/umd/ReactDOMServerUMDEntry.js new
+16
@@ -0,0 +1,16 @@
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 + * @providesModule ReactDOMServerUMDEntry
10 + */
11 +
12 +'use strict';
13 +
14 +var ReactDOMServer = require('ReactDOMServer');
15 +
16 +module.exports = ReactDOMServer;
src/umd/ReactDOMUMDEntry.js new
+34
@@ -0,0 +1,34 @@
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 + * @providesModule ReactDOMUMDEntry
10 + */
11 +
12 +'use strict';
13 +
14 +var ReactDOM = require('ReactDOM');
15 +
16 +var ReactDOMUMDEntry = Object.assign({
17 + __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED: {
18 + ReactInstanceMap: require('ReactInstanceMap'),
19 + },
20 +}, ReactDOM);
21 +
22 +if (__DEV__) {
23 + Object.assign(
24 + ReactDOMUMDEntry.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,
25 + {
26 + // ReactPerf and ReactTestUtils currently only work with the DOM renderer
27 + // so we expose them from here, but only in DEV mode.
28 + ReactPerf: require('ReactPerf'),
29 + ReactTestUtils: require('ReactTestUtils'),
30 + }
31 + );
32 +}
33 +
34 +module.exports = ReactDOMUMDEntry;
src/umd/ReactUMDEntry.js
+5 -6
@@ -11,15 +11,14 @@
11
12 'use strict';
13
14 -var ReactDOM = require('ReactDOM');
15 -var ReactDOMServer = require('ReactDOMServer');
14 var React = require('React');
15
18 -
19 -// `version` will be added here by ReactIsomorphic.
16 +// `version` will be added here by the React module.
17 var ReactUMDEntry = Object.assign({
21 - __SECRET_DOM_DO_NOT_USE_OR_YOU_WILL_BE_FIRED: ReactDOM,
22 - __SECRET_DOM_SERVER_DO_NOT_USE_OR_YOU_WILL_BE_FIRED: ReactDOMServer,
18 + __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED: {
19 + ReactCurrentOwner: require('ReactCurrentOwner'),
20 + ReactComponentTreeHook: require('ReactComponentTreeHook'),
21 + },
22 }, React);
23
24 module.exports = ReactUMDEntry;
src/umd/ReactWithAddonsUMDEntry.js
+5 -6
@@ -11,15 +11,14 @@
11
12 'use strict';
13
14 -var ReactDOM = require('ReactDOM');
15 -var ReactDOMServer = require('ReactDOMServer');
14 var ReactWithAddons = require('ReactWithAddons');
15
18 -
19 -// `version` will be added here by ReactIsomorphic.
16 +// `version` will be added here by the React module.
17 var ReactWithAddonsUMDEntry = Object.assign({
21 - __SECRET_DOM_DO_NOT_USE_OR_YOU_WILL_BE_FIRED: ReactDOM,
22 - __SECRET_DOM_SERVER_DO_NOT_USE_OR_YOU_WILL_BE_FIRED: ReactDOMServer,
18 + __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED: {
19 + ReactCurrentOwner: require('ReactCurrentOwner'),
20 + ReactComponentTreeHook: require('ReactComponentTreeHook'),
21 + },
22 }, ReactWithAddons);
23
24 module.exports = ReactWithAddonsUMDEntry;
src/umd/shims/ReactAddonsDOMDependenciesUMDShim.js new
+32
@@ -0,0 +1,32 @@
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 + * @providesModule ReactAddonsDOMDependenciesUMDShim
10 + */
11 +
12 +/* globals ReactDOM */
13 +
14 +'use strict';
15 +
16 +exports.getReactDOM = function() {
17 + return ReactDOM;
18 +};
19 +
20 +exports.getReactInstanceMap = function() {
21 + return ReactDOM.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactInstanceMap;
22 +};
23 +
24 +if (__DEV__) {
25 + exports.getReactPerf = function() {
26 + return ReactDOM.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactPerf;
27 + };
28 +
29 + exports.getReactTestUtils = function() {
30 + return ReactDOM.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactTestUtils;
31 + };
32 +}
vendor/react-dom-server.js deleted
-31
@@ -1,31 +0,0 @@
1 -// Based off https://github.com/ForbesLindesay/umd/blob/master/template.js
2 -;(function(f) {
3 - // CommonJS
4 - if (typeof exports === "object" && typeof module !== "undefined") {
5 - module.exports = f(require('react'));
6 -
7 - // RequireJS
8 - } else if (typeof define === "function" && define.amd) {
9 - define(['react'], f);
10 -
11 - // <script>
12 - } else {
13 - var g;
14 - if (typeof window !== "undefined") {
15 - g = window;
16 - } else if (typeof global !== "undefined") {
17 - g = global;
18 - } else if (typeof self !== "undefined") {
19 - g = self;
20 - } else {
21 - // works providing we're not in "use strict";
22 - // needed for Java 8 Nashorn
23 - // see https://github.com/facebook/react/issues/3037
24 - g = this;
25 - }
26 - g.ReactDOMServer = f(g.React);
27 - }
28 -
29 -})(function(React) {
30 - return React.__SECRET_DOM_SERVER_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
31 -});
vendor/react-dom.js deleted
-31
@@ -1,31 +0,0 @@
1 -// Based off https://github.com/ForbesLindesay/umd/blob/master/template.js
2 -;(function(f) {
3 - // CommonJS
4 - if (typeof exports === "object" && typeof module !== "undefined") {
5 - module.exports = f(require('react'));
6 -
7 - // RequireJS
8 - } else if (typeof define === "function" && define.amd) {
9 - define(['react'], f);
10 -
11 - // <script>
12 - } else {
13 - var g;
14 - if (typeof window !== "undefined") {
15 - g = window;
16 - } else if (typeof global !== "undefined") {
17 - g = global;
18 - } else if (typeof self !== "undefined") {
19 - g = self;
20 - } else {
21 - // works providing we're not in "use strict";
22 - // needed for Java 8 Nashorn
23 - // see https://github.com/facebook/react/issues/3037
24 - g = this;
25 - }
26 - g.ReactDOM = f(g.React);
27 - }
28 -
29 -})(function(React) {
30 - return React.__SECRET_DOM_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
31 -});