improve options parser

Reviewed By: jeanlauliac

Differential Revision: D4146832

fbshipit-source-id: a54284ccc3fa4d6e1628886b748b21b9b9af2cff
This commit is contained in:
David Aurelio 2016-11-08 09:58:54 -08:00 committed by Facebook Github Bot
parent 3ae8e44f34
commit 101977eb19
2 changed files with 33 additions and 1 deletions

View File

@ -70,7 +70,7 @@ function transformJSON(infile, options, outfile, callback) {
}
function transformModule(infile, options, outfile, callback) {
const filename = options.filename || infile;
const filename = infile;
if (filename.endsWith('.json')) {
return transformJSON(infile, options, outfile, callback);
}

View File

@ -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