mirror of https://github.com/status-im/metro.git
Move "transformFile" to "transform" to match worker interface
Reviewed By: cpojer Differential Revision: D6968803 fbshipit-source-id: 7dee92d5a58e18bb1ee0d5cd5748acd44cde5b18
This commit is contained in:
parent
b129827fa2
commit
e651b81881
|
@ -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,
|
||||||
|
|
|
@ -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(
|
||||||
|
|
|
@ -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);
|
||||||
|
|
Loading…
Reference in New Issue