Stronger typing for transformers

Reviewed By: jeanlauliac

Differential Revision: D5006679

fbshipit-source-id: 795c60db363fb53bc74697e4befe50995e9b97a7
This commit is contained in:
David Aurelio
2017-05-09 08:02:08 -07:00
committed by Facebook Github Bot
parent 3dfed2e865
commit 73fc439bc0
12 changed files with 102 additions and 61 deletions

View File

@@ -5,6 +5,8 @@
* 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';
@@ -24,7 +26,7 @@ babelRegisterOnly([]);
const transformer = require('../packager/transformer.js');
module.exports = {
process(src, file) {
process(src/*: string*/, file/*: string*/) {
if (nodeFiles.test(file)) { // node specific transforms only
return babel.transform(
src,
@@ -32,7 +34,12 @@ module.exports = {
).code;
}
return transformer.transform(src, file, {inlineRequires: true}).code;
return transformer.transform(src, file, {
dev: true,
inlineRequires: true,
platform: '',
projectRoot: '',
}).code;
},
getCacheKey: createCacheKeyFunction([