Bug 1217979 - Remove production version of react from the tree and only use dev for model validation and test addons. r=jlongster

This commit is contained in:
Jordan Santell 2015-10-23 13:19:41 -07:00
parent 9ac6546bf0
commit cc6bde94cc
5 changed files with 332 additions and 21037 deletions

View File

@ -3,26 +3,6 @@ var { classes: Cc, interfaces: Ci, utils: Cu } = Components;
const loaders = Cu.import("resource://gre/modules/commonjs/toolkit/loader.js", {}); const loaders = Cu.import("resource://gre/modules/commonjs/toolkit/loader.js", {});
const devtools = Cu.import("resource://devtools/shared/Loader.jsm", {}).devtools; const devtools = Cu.import("resource://devtools/shared/Loader.jsm", {}).devtools;
const { joinURI } = devtools.require("devtools/shared/path"); const { joinURI } = devtools.require("devtools/shared/path");
var appConstants;
// Some of the services that the system module requires is not
// available in xpcshell tests. This is ok, we can easily polyfill the
// values that we need.
try {
const system = devtools.require("devtools/shared/system");
appConstants = system.constants;
}
catch(e) {
// We are in a testing environment most likely. There isn't much
// risk to this defaulting to true because the dev version of React
// will be loaded if this is true, and that file doesn't get built
// into the release version of Firefox, so this will only work with
// dev environments.
appConstants = {
DEBUG_JS_MODULES: true
};
}
const VENDOR_CONTENT_URL = "resource://devtools/client/shared/vendor"; const VENDOR_CONTENT_URL = "resource://devtools/client/shared/vendor";
/* /*
@ -51,20 +31,12 @@ const VENDOR_CONTENT_URL = "resource://devtools/client/shared/vendor";
* - require: a function to require modules with * - require: a function to require modules with
*/ */
function BrowserLoader(baseURI, window) { function BrowserLoader(baseURI, window) {
const loaderOptions = devtools.require('@loader/options'); const loaderOptions = devtools.require("@loader/options");
let dynamicPaths = {};
if (appConstants.DEBUG_JS_MODULES) {
// Load in the dev version of React
dynamicPaths["devtools/shared/vendor/react"] =
"resource://devtools/vendor/react-dev.js";
}
const opts = { const opts = {
id: "browser-loader", id: "browser-loader",
sharedGlobal: true, sharedGlobal: true,
sandboxPrototype: window, sandboxPrototype: window,
paths: Object.assign({}, loaderOptions.paths, dynamicPaths), paths: Object.assign({}, loaderOptions.paths),
invisibleToDebugger: loaderOptions.invisibleToDebugger, invisibleToDebugger: loaderOptions.invisibleToDebugger,
require: (id, require) => { require: (id, require) => {
const uri = require.resolve(id); const uri = require.resolve(id);

View File

@ -3,12 +3,16 @@ sanity checks and better errors, but at a slight perf cost. The prod
version available on the web is by default minified, but we don't want version available on the web is by default minified, but we don't want
a minified version, so we need to build it ourselves. a minified version, so we need to build it ourselves.
The react.js and react-dev.js were generated with the following steps: In bug 1217979, we are only using react in development environment for now until
we can think of a way to conditionally build these different versions, so
the `react.js` here is the dev environment one and generated with the following steps:
* git clone https://github.com/facebook/react.git && cd react * git clone https://github.com/facebook/react.git && cd react
* npm install * npm install
* grunt build * grunt build
* cp build/react-with-addons.js <gecko-dev>/devtools/client/shared/vendor/react-dev.js * cp build/react-with-addons.js <gecko-dev>/devtools/client/shared/vendor/react.js
For production, which we do not currently have:
* NODE_ENV=production grunt build * NODE_ENV=production grunt build
* cp build/react-with-addons.js <gecko-dev>/devtools/client/shared/vendor/react.js * cp build/react-with-addons.js <gecko-dev>/devtools/client/shared/vendor/react.js

View File

@ -4,20 +4,8 @@
# License, v. 2.0. If a copy of the MPL was not distributed with this # License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/. # file, You can obtain one at http://mozilla.org/MPL/2.0/.
modules = [] DevToolsModules(
if CONFIG['DEBUG_JS_MODULES']:
modules += [
'react-dev.js',
]
modules += [
'react-redux.js', 'react-redux.js',
'react.js', 'react.js',
'redux.js', 'redux.js',
] )
# Currently `DevToolsModules` can only be called once per moz.build, so we build
# a list manually above. Bug 1198013 tracks fixing this to make it more like
# other moz.build constructs.
DevToolsModules(*modules)

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff