Fix breakages when upgrading to babel 6

Reviewed By: vjeux

Differential Revision: D2628092

fb-gh-sync-id: 077a3572fe8b261d390be2bdc32d9d06c2b80a01
This commit is contained in:
Tadeu Zagallo 2015-11-10 10:51:51 -08:00 committed by facebook-github-bot-2
parent 7ea13f835c
commit a7338495f8
4 changed files with 15 additions and 16 deletions

View File

@ -140,7 +140,8 @@ class Bundler {
dev: isDev, dev: isDev,
platform, platform,
}) { }) {
const bundle = new Bundle(sourceMapUrl); // Const cannot have the same name as the method (babel/babel#2834)
const bbundle = new Bundle(sourceMapUrl);
const findEventId = Activity.startEvent('find dependencies'); const findEventId = Activity.startEvent('find dependencies');
let transformEventId; let transformEventId;
@ -158,11 +159,11 @@ class Bundler {
}); });
} }
bundle.setMainModuleId(response.mainModuleId); bbundle.setMainModuleId(response.mainModuleId);
return Promise.all( return Promise.all(
response.dependencies.map( response.dependencies.map(
module => this._transformModule( module => this._transformModule(
bundle, bbundle,
response, response,
module, module,
platform platform
@ -178,11 +179,11 @@ class Bundler {
Activity.endEvent(transformEventId); Activity.endEvent(transformEventId);
transformedModules.forEach(function(moduleTransport) { transformedModules.forEach(function(moduleTransport) {
bundle.addModule(moduleTransport); bbundle.addModule(moduleTransport);
}); });
bundle.finalize({runBeforeMainModule, runMainModule}); bbundle.finalize({runBeforeMainModule, runMainModule});
return bundle; return bbundle;
}); });
} }

View File

@ -16,21 +16,18 @@ jest
.dontMock('../../lib/getCacheFilePath'); .dontMock('../../lib/getCacheFilePath');
jest jest
.mock('os') .mock('fs')
.mock('fs'); .setMock('os', {
tmpDir() { return 'tmpDir'; }
});
var Promise = require('promise'); var Promise = require('promise');
var fs = require('fs'); var fs = require('fs');
var os = require('os');
var _ = require('underscore'); var _ = require('underscore');
var Cache = require('../'); var Cache = require('../');
describe('JSTransformer Cache', () => { describe('JSTransformer Cache', () => {
beforeEach(() => {
os.tmpDir.mockImpl(() => 'tmpDir');
});
describe('getting/setting', () => { describe('getting/setting', () => {
pit('calls loader callback for uncached file', () => { pit('calls loader callback for uncached file', () => {
fs.stat.mockImpl((file, callback) => { fs.stat.mockImpl((file, callback) => {

View File

@ -46,9 +46,9 @@ describe('System.import', () => {
function transform(source) { function transform(source) {
return babel.transform(source, { return babel.transform(source, {
plugins: [require('../')], plugins: [
blacklist: ['strict'], [require('../'), { bundlesLayout: layout }]
extra: { bundlesLayout: layout }, ],
}).code; }).code;
} }

View File

@ -47,6 +47,7 @@ function transform(src, filename, options) {
'transform-flow-strip-types', 'transform-flow-strip-types',
'transform-object-assign', 'transform-object-assign',
'transform-object-rest-spread', 'transform-object-rest-spread',
'transform-object-assign',
'transform-react-display-name', 'transform-react-display-name',
'transform-react-jsx', 'transform-react-jsx',
'transform-regenerator', 'transform-regenerator',