improve options parser
Reviewed By: jeanlauliac Differential Revision: D4146832 fbshipit-source-id: a54284ccc3fa4d6e1628886b748b21b9b9af2cff
This commit is contained in:
parent
72d11912f4
commit
4301cfc066
|
@ -70,7 +70,7 @@ function transformJSON(infile, options, outfile, callback) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function transformModule(infile, options, outfile, callback) {
|
function transformModule(infile, options, outfile, callback) {
|
||||||
const filename = options.filename || infile;
|
const filename = infile;
|
||||||
if (filename.endsWith('.json')) {
|
if (filename.endsWith('.json')) {
|
||||||
return transformJSON(infile, options, outfile, callback);
|
return transformJSON(infile, options, outfile, callback);
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,32 @@
|
||||||
|
/**
|
||||||
|
* Copyright (c) 2016-present, Facebook, Inc.
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* This source code is licensed under the BSD-style license found in the
|
||||||
|
* LICENSE file in the root directory of this source tree. An additional grant
|
||||||
|
* of patent rights can be found in the PATENTS file in the same directory.
|
||||||
|
*
|
||||||
|
* @flow
|
||||||
|
*/
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
declare export function transformModule(
|
||||||
|
infile: string,
|
||||||
|
options: {
|
||||||
|
filename?: string,
|
||||||
|
transform: string,
|
||||||
|
variants?: {[key: string]: Object},
|
||||||
|
},
|
||||||
|
outfile: string,
|
||||||
|
callback: (e?: Error) => void,
|
||||||
|
): void
|
||||||
|
|
||||||
|
declare export function optimizeModule(
|
||||||
|
infile: string,
|
||||||
|
outfile: string,
|
||||||
|
options: {
|
||||||
|
dev?: boolean,
|
||||||
|
platform?: string,
|
||||||
|
},
|
||||||
|
callback: (e?: Error) => void,
|
||||||
|
): void
|
Loading…
Reference in New Issue