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 6eec446106
commit b907f40957
6 changed files with 19 additions and 22 deletions

View File

@ -11,7 +11,7 @@
*/
'use strict';
var bezier = require('bezier');
var _bezier = require('bezier');
/**
* This class implements common easing functions. The math is pretty obscure,
@ -114,7 +114,7 @@ class Easing {
epsilon = (1000 / 60 / duration) / 4;
}
return bezier(x1, y1, x2, y2, epsilon);
return _bezier(x1, y1, x2, y2, epsilon);
}
static in(

View File

@ -8,12 +8,10 @@
*/
'use strict';
jest
.dontMock('../saveBundleAndMap')
.dontMock('os-tmpdir')
.dontMock('temp');
jest.autoMockOff();
jest.mock('fs');
jest.mock('../sign');
const saveBundleAndMap = require('../saveBundleAndMap');
const fs = require('fs');

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',