From e651b8188147b6ecc8087f1199d93f255a2a27f2 Mon Sep 17 00:00:00 2001 From: Miguel Jimenez Esun Date: Fri, 16 Feb 2018 11:37:43 -0800 Subject: [PATCH] Move "transformFile" to "transform" to match worker interface Reviewed By: cpojer Differential Revision: D6968803 fbshipit-source-id: 7dee92d5a58e18bb1ee0d5cd5748acd44cde5b18 --- packages/metro/src/Bundler/index.js | 2 +- .../metro/src/JSTransformer/__tests__/Transformer-test.js | 4 ++-- packages/metro/src/JSTransformer/index.js | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/metro/src/Bundler/index.js b/packages/metro/src/Bundler/index.js index da0dbb90..bca3d1fe 100644 --- a/packages/metro/src/Bundler/index.js +++ b/packages/metro/src/Bundler/index.js @@ -158,7 +158,7 @@ class Bundler { resetCache: opts.resetCache, sourceExts: opts.sourceExts, transformCode: (module, code, transformCodeOptions) => - this._transformer.transformFile( + this._transformer.transform( module.path, module.localPath, code, diff --git a/packages/metro/src/JSTransformer/__tests__/Transformer-test.js b/packages/metro/src/JSTransformer/__tests__/Transformer-test.js index 1e7a73ea..32358459 100644 --- a/packages/metro/src/JSTransformer/__tests__/Transformer-test.js +++ b/packages/metro/src/JSTransformer/__tests__/Transformer-test.js @@ -64,7 +64,7 @@ describe('Transformer', function() { const transformOptions = {arbitrary: 'options'}; const code = 'arbitrary(code)'; - new Transformer(opts).transformFile( + new Transformer(opts).transform( fileName, localPath, code, @@ -108,7 +108,7 @@ describe('Transformer', function() { expect.assertions(6); return transformer - .transformFile(fileName, localPath, '', true, {}) + .transform(fileName, localPath, '', true, {}) .catch(function(error) { expect(error.type).toEqual('TransformError'); expect(error.message).toBe( diff --git a/packages/metro/src/JSTransformer/index.js b/packages/metro/src/JSTransformer/index.js index f9d0a377..d20e632c 100644 --- a/packages/metro/src/JSTransformer/index.js +++ b/packages/metro/src/JSTransformer/index.js @@ -91,7 +91,7 @@ module.exports = class Transformer { return await this._worker.minify(filename, code, sourceMap); } - async transformFile( + async transform( filename: string, localPath: LocalPath, code: string, @@ -123,7 +123,7 @@ module.exports = class Transformer { return data.result; } catch (err) { - debug('Failed transformFile file', filename); + debug('Failed transform file', filename); if (err.loc) { throw this._formatBabelError(err, filename);