Make Browserify-specific modules to remove DOM dependencies from npm package
Paul O’Shannessy committed
Mar 24, 2016 at 11:00 UTC
d17091ddebf317173eb30e3ab4a8e28e124c8f50
6 files changed
+38
-26
grunt/config/browserify.js
+4
-4
@@ -50,7 +50,7 @@ function simpleBannerify(src) {
50
// Our basic config which we'll add to to make our other builds
51
var basic = {
52
entries: [
53
- './build/modules/React.js',
53
+ './build/modules/ReactUMDEntry.js',
54
],
55
outfile: './build/react.js',
56
debug: false,
@@ -63,7 +63,7 @@ var basic = {
63
64
var min = {
65
entries: [
66
- './build/modules/React.js',
66
+ './build/modules/ReactUMDEntry.js',
67
],
68
outfile: './build/react.min.js',
69
debug: false,
@@ -81,7 +81,7 @@ var min = {
81
82
var addons = {
83
entries: [
84
- './build/modules/ReactWithAddons.js',
84
+ './build/modules/ReactWithAddonsUMDEntry.js',
85
],
86
outfile: './build/react-with-addons.js',
87
debug: false,
@@ -94,7 +94,7 @@ var addons = {
94
95
var addonsMin = {
96
entries: [
97
- './build/modules/ReactWithAddons.js',
97
+ './build/modules/ReactWithAddonsUMDEntry.js',
98
],
99
outfile: './build/react-with-addons.min.js',
100
debug: false,
packages/react/lib/React.native.js
deleted
-5
@@ -1,5 +0,0 @@
1
-'use strict';
2
-
3
-// TODO: Once we remove the DOM bits from React, this shim can go away.
4
-
5
-module.exports = require('./ReactIsomorphic');
src/addons/ReactWithAddons.js
-7
@@ -9,13 +9,6 @@
9
* @providesModule ReactWithAddons
10
*/
11
12
-/**
13
- * This module exists purely in the open source project, and is meant as a way
14
- * to create a separate standalone build of React. This build has "addons", or
15
- * functionality we've built and think might be useful but doesn't have a good
16
- * place to live inside React core.
17
- */
18
-
12
'use strict';
13
14
var LinkedStateMixin = require('LinkedStateMixin');
src/isomorphic/React.js
renamed
+1
-1
@@ -6,7 +6,7 @@
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 ReactIsomorphic
9
+ * @providesModule React
10
*/
11
12
'use strict';
src/umd/ReactUMDEntry.js
renamed
+7
-9
@@ -6,23 +6,21 @@
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 React
9
+ * @providesModule ReactUMDEntry
10
*/
11
12
'use strict';
13
14
var ReactDOM = require('ReactDOM');
15
var ReactDOMServer = require('ReactDOMServer');
16
-var ReactIsomorphic = require('ReactIsomorphic');
16
+var React = require('React');
17
18
var assign = require('Object.assign');
19
20
// `version` will be added here by ReactIsomorphic.
21
-var React = {};
21
+var ReactUMDEntry = assign({
22
+ __SECRET_DOM_DO_NOT_USE_OR_YOU_WILL_BE_FIRED: ReactDOM,
23
+ __SECRET_DOM_SERVER_DO_NOT_USE_OR_YOU_WILL_BE_FIRED: ReactDOMServer,
24
+}, React);
25
23
-assign(React, ReactIsomorphic);
24
-
25
-React.__SECRET_DOM_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = ReactDOM;
26
-React.__SECRET_DOM_SERVER_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = ReactDOMServer;
27
-
28
-module.exports = React;
26
+module.exports = ReactUMDEntry;
src/umd/ReactWithAddonsUMDEntry.js
new
+26
@@ -0,0 +1,26 @@
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 ReactWithAddonsUMDEntry
10
+ */
11
+
12
+'use strict';
13
+
14
+var ReactDOM = require('ReactDOM');
15
+var ReactDOMServer = require('ReactDOMServer');
16
+var ReactWithAddons = require('ReactWithAddons');
17
+
18
+var assign = require('Object.assign');
19
+
20
+// `version` will be added here by ReactIsomorphic.
21
+var ReactWithAddonsUMDEntry = assign({
22
+ __SECRET_DOM_DO_NOT_USE_OR_YOU_WILL_BE_FIRED: ReactDOM,
23
+ __SECRET_DOM_SERVER_DO_NOT_USE_OR_YOU_WILL_BE_FIRED: ReactDOMServer,
24
+}, ReactWithAddons);
25
+
26
+module.exports = ReactWithAddonsUMDEntry;