mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Remove baseTransformer
Reviewed By: jeanlauliac Differential Revision: D4506124 fbshipit-source-id: 642f06dffe4ea710113e8e8426915bf1b40d4611
This commit is contained in:
committed by
Facebook Github Bot
parent
57990b7970
commit
a4d7a7835f
@@ -21,8 +21,8 @@ const {basename} = require('path');
|
||||
import type {
|
||||
Callback,
|
||||
TransformedFile,
|
||||
TransformFn,
|
||||
TransformFnResult,
|
||||
Transformer,
|
||||
TransformerResult,
|
||||
TransformResult,
|
||||
TransformVariants,
|
||||
} from '../types.flow';
|
||||
@@ -30,7 +30,7 @@ import type {
|
||||
export type TransformOptions = {|
|
||||
filename: string,
|
||||
polyfill?: boolean,
|
||||
transform: TransformFn,
|
||||
transformer: Transformer,
|
||||
variants?: TransformVariants,
|
||||
|};
|
||||
|
||||
@@ -47,17 +47,23 @@ function transformModule(
|
||||
return transformJSON(code, options, callback);
|
||||
}
|
||||
|
||||
const {filename, transform, variants = defaultVariants} = options;
|
||||
const {filename, transformer, variants = defaultVariants} = options;
|
||||
const tasks = {};
|
||||
Object.keys(variants).forEach(name => {
|
||||
tasks[name] = cb => transform({
|
||||
filename,
|
||||
sourceCode: code,
|
||||
options: variants[name],
|
||||
}, cb);
|
||||
tasks[name] = cb => {
|
||||
try {
|
||||
cb(null, transformer.transform(
|
||||
code,
|
||||
filename,
|
||||
variants[name],
|
||||
));
|
||||
} catch (error) {
|
||||
cb(error, null);
|
||||
}
|
||||
};
|
||||
});
|
||||
|
||||
series(tasks, (error, results: {[key: string]: TransformFnResult}) => {
|
||||
series(tasks, (error, results: {[key: string]: TransformerResult}) => {
|
||||
if (error) {
|
||||
callback(error);
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user