mirror of https://github.com/status-im/metro.git
Support async transformers
Reviewed By: rafeca, mjesun Differential Revision: D6405491 fbshipit-source-id: 7110135e9f75ab43c03710abfa8e582577662ab3
This commit is contained in:
parent
a766a4a499
commit
b7ba5c7ee1
|
@ -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,
|
||||||
|
|
Loading…
Reference in New Issue