Skip to content

Commit

Permalink
Make Browserify-specific modules to remove DOM dependencies from npm …
Browse files Browse the repository at this point in the history
…package
  • Loading branch information
zpao committed Mar 24, 2016
1 parent d8ee071 commit d17091d
Show file tree
Hide file tree
Showing 6 changed files with 38 additions and 26 deletions.
8 changes: 4 additions & 4 deletions grunt/config/browserify.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ function simpleBannerify(src) {
// Our basic config which we'll add to to make our other builds
var basic = {
entries: [
'./build/modules/React.js',
'./build/modules/ReactUMDEntry.js',
],
outfile: './build/react.js',
debug: false,
Expand All @@ -63,7 +63,7 @@ var basic = {

var min = {
entries: [
'./build/modules/React.js',
'./build/modules/ReactUMDEntry.js',
],
outfile: './build/react.min.js',
debug: false,
Expand All @@ -81,7 +81,7 @@ var min = {

var addons = {
entries: [
'./build/modules/ReactWithAddons.js',
'./build/modules/ReactWithAddonsUMDEntry.js',
],
outfile: './build/react-with-addons.js',
debug: false,
Expand All @@ -94,7 +94,7 @@ var addons = {

var addonsMin = {
entries: [
'./build/modules/ReactWithAddons.js',
'./build/modules/ReactWithAddonsUMDEntry.js',
],
outfile: './build/react-with-addons.min.js',
debug: false,
Expand Down
5 changes: 0 additions & 5 deletions packages/react/lib/React.native.js

This file was deleted.

7 changes: 0 additions & 7 deletions src/addons/ReactWithAddons.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,6 @@
* @providesModule ReactWithAddons
*/

/**
* This module exists purely in the open source project, and is meant as a way
* to create a separate standalone build of React. This build has "addons", or
* functionality we've built and think might be useful but doesn't have a good
* place to live inside React core.
*/

'use strict';

var LinkedStateMixin = require('LinkedStateMixin');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule ReactIsomorphic
* @providesModule React
*/

'use strict';
Expand Down
16 changes: 7 additions & 9 deletions src/React.js → src/umd/ReactUMDEntry.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,23 +6,21 @@
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule React
* @providesModule ReactUMDEntry
*/

'use strict';

var ReactDOM = require('ReactDOM');
var ReactDOMServer = require('ReactDOMServer');
var ReactIsomorphic = require('ReactIsomorphic');
var React = require('React');

var assign = require('Object.assign');

// `version` will be added here by ReactIsomorphic.
var React = {};
var ReactUMDEntry = assign({
__SECRET_DOM_DO_NOT_USE_OR_YOU_WILL_BE_FIRED: ReactDOM,
__SECRET_DOM_SERVER_DO_NOT_USE_OR_YOU_WILL_BE_FIRED: ReactDOMServer,
}, React);

assign(React, ReactIsomorphic);

React.__SECRET_DOM_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = ReactDOM;
React.__SECRET_DOM_SERVER_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = ReactDOMServer;

module.exports = React;
module.exports = ReactUMDEntry;
26 changes: 26 additions & 0 deletions src/umd/ReactWithAddonsUMDEntry.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/**
* Copyright 2013-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule ReactWithAddonsUMDEntry
*/

'use strict';

var ReactDOM = require('ReactDOM');
var ReactDOMServer = require('ReactDOMServer');
var ReactWithAddons = require('ReactWithAddons');

var assign = require('Object.assign');

// `version` will be added here by ReactIsomorphic.
var ReactWithAddonsUMDEntry = assign({
__SECRET_DOM_DO_NOT_USE_OR_YOU_WILL_BE_FIRED: ReactDOM,
__SECRET_DOM_SERVER_DO_NOT_USE_OR_YOU_WILL_BE_FIRED: ReactDOMServer,
}, ReactWithAddons);

module.exports = ReactWithAddonsUMDEntry;

0 comments on commit d17091d

Please sign in to comment.