mirror of
https://github.com/hanzoai/react.git
synced 2026-09-24 17:02:27 +00:00
Actually build react-dom file with the build
This commit is contained in:
@@ -16,3 +16,4 @@ packages/react-codemod/test/
|
||||
packages/react-codemod/scripts/
|
||||
packages/react-codemod/build/
|
||||
packages/react-codemod/node_modules/
|
||||
vendor/react-dom.js
|
||||
|
||||
@@ -107,6 +107,7 @@ module.exports = function(grunt) {
|
||||
'build-modules',
|
||||
'npm-react:release',
|
||||
]);
|
||||
grunt.registerTask('build:react-dom', require('./grunt/tasks/react-dom'));
|
||||
|
||||
grunt.registerTask('test', ['jest']);
|
||||
grunt.registerTask('npm:test', ['build', 'npm:pack']);
|
||||
@@ -124,6 +125,7 @@ module.exports = function(grunt) {
|
||||
'browserify:addons',
|
||||
'browserify:min',
|
||||
'browserify:addonsMin',
|
||||
'build:react-dom',
|
||||
'npm-react:release',
|
||||
'npm-react:pack',
|
||||
'npm-react-dom:pack',
|
||||
|
||||
Vendored
+27
@@ -0,0 +1,27 @@
|
||||
'use strict';
|
||||
|
||||
var grunt = require('grunt');
|
||||
var UglifyJS = require('uglify-js');
|
||||
|
||||
var LICENSE_TEMPLATE =
|
||||
grunt.file.read('./grunt/data/header-template-extended.txt');
|
||||
|
||||
module.exports = function() {
|
||||
var templateData = {
|
||||
package: 'ReactDOM',
|
||||
version: grunt.config.data.pkg.version,
|
||||
};
|
||||
var header = grunt.template.process(
|
||||
LICENSE_TEMPLATE,
|
||||
{data: templateData}
|
||||
);
|
||||
var src = grunt.file.read('vendor/react-dom.js');
|
||||
grunt.file.write(
|
||||
'build/react-dom.js',
|
||||
header + src
|
||||
);
|
||||
grunt.file.write(
|
||||
'build/react-dom.min.js',
|
||||
header + UglifyJS.minify(src, {fromString: true}).code
|
||||
);
|
||||
};
|
||||
@@ -64,4 +64,6 @@ assign(React, {
|
||||
),
|
||||
});
|
||||
|
||||
React.__SECRET_DOM_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = ReactDOM;
|
||||
|
||||
module.exports = React;
|
||||
|
||||
Vendored
+31
@@ -0,0 +1,31 @@
|
||||
// Based off https://github.com/ForbesLindesay/umd/blob/master/template.js
|
||||
;(function(f) {
|
||||
// CommonJS
|
||||
if (typeof exports === "object" && typeof module !== "undefined") {
|
||||
module.exports = f(require('react'));
|
||||
|
||||
// RequireJS
|
||||
} else if (typeof define === "function" && define.amd) {
|
||||
define(['react'], f);
|
||||
|
||||
// <script>
|
||||
} else {
|
||||
var g
|
||||
if (typeof window !== "undefined") {
|
||||
g = window;
|
||||
} else if (typeof global !== "undefined") {
|
||||
g = global;
|
||||
} else if (typeof self !== "undefined") {
|
||||
g = self;
|
||||
} else {
|
||||
// works providing we're not in "use strict";
|
||||
// needed for Java 8 Nashorn
|
||||
// see https://github.com/facebook/react/issues/3037
|
||||
g = this;
|
||||
}
|
||||
g.ReactDOM = f(g.React);
|
||||
}
|
||||
|
||||
})(function(React) {
|
||||
return React.__SECRET_DOM_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
|
||||
});
|
||||
Reference in New Issue
Block a user