Move "transformFile" to "transform" to match worker interface

Reviewed By: cpojer

Differential Revision: D6968803

fbshipit-source-id: 7dee92d5a58e18bb1ee0d5cd5748acd44cde5b18
This commit is contained in:
Miguel Jimenez Esun 2018-02-16 11:37:43 -08:00 committed by Facebook Github Bot
parent b129827fa2
commit e651b81881
3 changed files with 5 additions and 5 deletions

View File

@ -158,7 +158,7 @@ class Bundler {
resetCache: opts.resetCache, resetCache: opts.resetCache,
sourceExts: opts.sourceExts, sourceExts: opts.sourceExts,
transformCode: (module, code, transformCodeOptions) => transformCode: (module, code, transformCodeOptions) =>
this._transformer.transformFile( this._transformer.transform(
module.path, module.path,
module.localPath, module.localPath,
code, code,

View File

@ -64,7 +64,7 @@ describe('Transformer', function() {
const transformOptions = {arbitrary: 'options'}; const transformOptions = {arbitrary: 'options'};
const code = 'arbitrary(code)'; const code = 'arbitrary(code)';
new Transformer(opts).transformFile( new Transformer(opts).transform(
fileName, fileName,
localPath, localPath,
code, code,
@ -108,7 +108,7 @@ describe('Transformer', function() {
expect.assertions(6); expect.assertions(6);
return transformer return transformer
.transformFile(fileName, localPath, '', true, {}) .transform(fileName, localPath, '', true, {})
.catch(function(error) { .catch(function(error) {
expect(error.type).toEqual('TransformError'); expect(error.type).toEqual('TransformError');
expect(error.message).toBe( expect(error.message).toBe(

View File

@ -91,7 +91,7 @@ module.exports = class Transformer {
return await this._worker.minify(filename, code, sourceMap); return await this._worker.minify(filename, code, sourceMap);
} }
async transformFile( async transform(
filename: string, filename: string,
localPath: LocalPath, localPath: LocalPath,
code: string, code: string,
@ -123,7 +123,7 @@ module.exports = class Transformer {
return data.result; return data.result;
} catch (err) { } catch (err) {
debug('Failed transformFile file', filename); debug('Failed transform file', filename);
if (err.loc) { if (err.loc) {
throw this._formatBabelError(err, filename); throw this._formatBabelError(err, filename);