forked from facebook/react
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This reworks a few things in building and distributing React. The biggest change is using fbjs to share dependencies with other libraries. We're also using Gulp for some build steps.
- Loading branch information
Showing
49 changed files
with
167 additions
and
1,637 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
/** | ||
* Copyright 2013-2015, 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. | ||
*/ | ||
|
||
'use strict'; | ||
|
||
var gulp = require('gulp'); | ||
var babel = require('gulp-babel'); | ||
var flatten = require('gulp-flatten'); | ||
var del = require('del'); | ||
|
||
var babelPluginDEV = require('fbjs/scripts/babel/dev-expression'); | ||
var babelPluginRequires = require('fbjs/scripts/babel/rewrite-requires'); | ||
|
||
var paths = { | ||
react: { | ||
src: [ | ||
'src/**/*.js', | ||
'!src/**/__tests__/**/*.js', | ||
'!src/**/__mocks__/**/*.js', | ||
], | ||
lib: 'build/modules', | ||
}, | ||
}; | ||
|
||
var babelOpts = { | ||
nonStandard: true, | ||
blacklist: [ | ||
'spec.functionName', | ||
], | ||
optional: [ | ||
'es7.trailingFunctionCommas', | ||
], | ||
plugins: [babelPluginDEV, babelPluginRequires], | ||
ignore: ['third_party'], | ||
_moduleMap: require('fbjs/module-map'), | ||
}; | ||
|
||
gulp.task('react:clean', function(cb) { | ||
del([paths.react.lib], cb); | ||
}); | ||
|
||
gulp.task('react:modules', function() { | ||
return gulp | ||
.src(paths.react.src) | ||
.pipe(babel(babelOpts)) | ||
.pipe(flatten()) | ||
.pipe(gulp.dest(paths.react.lib)); | ||
}); | ||
|
||
gulp.task('default', ['react:modules']); |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
'use strict'; | ||
|
||
var babel = require('babel'); | ||
var coffee = require('coffee-script'); | ||
|
||
var tsPreprocessor = require('./ts-preprocessor'); | ||
|
||
var defaultLibraries = [ | ||
require.resolve('./jest.d.ts'), | ||
require.resolve('../../src/isomorphic/modern/class/React.d.ts'), | ||
]; | ||
|
||
var ts = tsPreprocessor(defaultLibraries); | ||
|
||
// This assumes the module map has been built. This might not be safe. | ||
// We should consider consuming this from a built fbjs module from npm. | ||
var moduleMap = require('fbjs/module-map'); | ||
var babelPluginDEV = require('fbjs/scripts/babel/dev-expression'); | ||
var babelPluginRequires = require('fbjs/scripts/babel/rewrite-requires'); | ||
|
||
module.exports = { | ||
process: function(src, path) { | ||
if (path.match(/\.coffee$/)) { | ||
return coffee.compile(src, {'bare': true}); | ||
} | ||
if (path.match(/\.ts$/) && !path.match(/\.d\.ts$/)) { | ||
return ts.compile(src, path); | ||
} | ||
// TODO: make sure this stays in sync with gulpfile | ||
if (!path.match(/\/node_modules\//) && !path.match(/\/third_party\//)) { | ||
var rv = babel.transform(src, { | ||
nonStandard: true, | ||
blacklist: [ | ||
'spec.functionName', | ||
'validation.react', | ||
], | ||
optional: [ | ||
'es7.trailingFunctionCommas', | ||
], | ||
plugins: [babelPluginDEV, babelPluginRequires], | ||
ignore: ['third_party'], | ||
filename: path, | ||
retainLines: true, | ||
_moduleMap: moduleMap, | ||
}).code; | ||
return rv; | ||
} | ||
return src; | ||
}, | ||
}; |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.