Support async transformers

Reviewed By: rafeca, mjesun

Differential Revision: D6405491

fbshipit-source-id: 7110135e9f75ab43c03710abfa8e582577662ab3
This commit is contained in:
Burak Yigit Kaya 2017-11-23 09:37:24 -08:00 committed by Facebook Github Bot
parent a766a4a499
commit b7ba5c7ee1
1 changed files with 3 additions and 3 deletions

View File

@ -93,13 +93,13 @@ export type Data = {
transformFileEndLogEntry: LogEntry, transformFileEndLogEntry: LogEntry,
}; };
function transformCode( async function transformCode(
transformer: Transformer<*>, transformer: Transformer<*>,
filename: string, filename: string,
localPath: LocalPath, localPath: LocalPath,
sourceCode: string, sourceCode: string,
options: Options, options: Options,
): Data { ): Promise<Data> {
const isJson = filename.endsWith('.json'); const isJson = filename.endsWith('.json');
if (isJson) { if (isJson) {
@ -118,7 +118,7 @@ function transformCode(
? [] ? []
: [[inline.plugin, options], [constantFolding.plugin, options]]; : [[inline.plugin, options], [constantFolding.plugin, options]];
const result = transformer.transform({ const result = await transformer.transform({
filename, filename,
localPath, localPath,
options: options.transform, options: options.transform,