Skip to content

Commit b907f40

Browse files
tadeuzagallofacebook-github-bot-2
authored andcommitted
Fix breakages when upgrading to babel 6
Reviewed By: vjeux Differential Revision: D2628092 fb-gh-sync-id: 077a3572fe8b261d390be2bdc32d9d06c2b80a01
1 parent 6eec446 commit b907f40

6 files changed

Lines changed: 19 additions & 22 deletions

File tree

Libraries/Animated/src/Easing.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
*/
1212
'use strict';
1313

14-
var bezier = require('bezier');
14+
var _bezier = require('bezier');
1515

1616
/**
1717
* This class implements common easing functions. The math is pretty obscure,
@@ -114,7 +114,7 @@ class Easing {
114114
epsilon = (1000 / 60 / duration) / 4;
115115
}
116116

117-
return bezier(x1, y1, x2, y2, epsilon);
117+
return _bezier(x1, y1, x2, y2, epsilon);
118118
}
119119

120120
static in(

local-cli/bundle/__tests__/saveBundleAndMap-test.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,10 @@
88
*/
99
'use strict';
1010

11-
jest
12-
.dontMock('../saveBundleAndMap')
13-
.dontMock('os-tmpdir')
14-
.dontMock('temp');
11+
jest.autoMockOff();
1512

1613
jest.mock('fs');
14+
jest.mock('../sign');
1715

1816
const saveBundleAndMap = require('../saveBundleAndMap');
1917
const fs = require('fs');

packager/react-packager/src/Bundler/index.js

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,8 @@ class Bundler {
140140
dev: isDev,
141141
platform,
142142
}) {
143-
const bundle = new Bundle(sourceMapUrl);
143+
// Const cannot have the same name as the method (babel/babel#2834)
144+
const bbundle = new Bundle(sourceMapUrl);
144145
const findEventId = Activity.startEvent('find dependencies');
145146
let transformEventId;
146147

@@ -158,11 +159,11 @@ class Bundler {
158159
});
159160
}
160161

161-
bundle.setMainModuleId(response.mainModuleId);
162+
bbundle.setMainModuleId(response.mainModuleId);
162163
return Promise.all(
163164
response.dependencies.map(
164165
module => this._transformModule(
165-
bundle,
166+
bbundle,
166167
response,
167168
module,
168169
platform
@@ -178,11 +179,11 @@ class Bundler {
178179
Activity.endEvent(transformEventId);
179180

180181
transformedModules.forEach(function(moduleTransport) {
181-
bundle.addModule(moduleTransport);
182+
bbundle.addModule(moduleTransport);
182183
});
183184

184-
bundle.finalize({runBeforeMainModule, runMainModule});
185-
return bundle;
185+
bbundle.finalize({runBeforeMainModule, runMainModule});
186+
return bbundle;
186187
});
187188
}
188189

packager/react-packager/src/Cache/__tests__/Cache-test.js

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,21 +16,18 @@ jest
1616
.dontMock('../../lib/getCacheFilePath');
1717

1818
jest
19-
.mock('os')
20-
.mock('fs');
19+
.mock('fs')
20+
.setMock('os', {
21+
tmpDir() { return 'tmpDir'; }
22+
});
2123

2224
var Promise = require('promise');
2325
var fs = require('fs');
24-
var os = require('os');
2526
var _ = require('underscore');
2627

2728
var Cache = require('../');
2829

2930
describe('JSTransformer Cache', () => {
30-
beforeEach(() => {
31-
os.tmpDir.mockImpl(() => 'tmpDir');
32-
});
33-
3431
describe('getting/setting', () => {
3532
pit('calls loader callback for uncached file', () => {
3633
fs.stat.mockImpl((file, callback) => {

packager/react-packager/src/transforms/babel-plugin-system-import/__tests__/babel-plugin-system-import-test.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,9 @@ describe('System.import', () => {
4646

4747
function transform(source) {
4848
return babel.transform(source, {
49-
plugins: [require('../')],
50-
blacklist: ['strict'],
51-
extra: { bundlesLayout: layout },
49+
plugins: [
50+
[require('../'), { bundlesLayout: layout }]
51+
],
5252
}).code;
5353
}
5454

packager/transformer.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ function transform(src, filename, options) {
4747
'transform-flow-strip-types',
4848
'transform-object-assign',
4949
'transform-object-rest-spread',
50+
'transform-object-assign',
5051
'transform-react-display-name',
5152
'transform-react-jsx',
5253
'transform-regenerator',

0 commit comments

Comments
 (0)