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,
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');
let transformEventId;
@ -158,11 +159,11 @@ class Bundler {
});
}
bundle.setMainModuleId(response.mainModuleId);
bbundle.setMainModuleId(response.mainModuleId);
return Promise.all(
response.dependencies.map(
module => this._transformModule(
bundle,
bbundle,
response,
module,
platform
@ -178,11 +179,11 @@ class Bundler {
Activity.endEvent(transformEventId);
transformedModules.forEach(function(moduleTransport) {
bundle.addModule(moduleTransport);
bbundle.addModule(moduleTransport);
});
bundle.finalize({runBeforeMainModule, runMainModule});
return bundle;
bbundle.finalize({runBeforeMainModule, runMainModule});
return bbundle;
});
}

View File

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

View File

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

View File

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