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

@@ -24,7 +24,7 @@ const throat = require('throat');
import type {
Options as TransformWorkerOptions,
TransformOptions,
TransformOptionsStrict,
} from '../JSTransformer/worker/worker';
import type {CachedResult, GetTransformCacheKey} from './TransformCache';
@@ -381,7 +381,7 @@ class OptionsHasher {
* of the cache key as they should not affect the transformation of a single
* particular file.
*/
hashTransformOptions(hash: crypto$Hash, options: TransformOptions): crypto$Hash {
hashTransformOptions(hash: crypto$Hash, options: TransformOptionsStrict): crypto$Hash {
const {
generateSourceMaps, dev, hot, inlineRequires, platform, projectRoot,
...unknowns,

View File

@@ -20,7 +20,7 @@ const rimraf = require('rimraf');
const terminal = require('../lib/terminal');
const writeFileAtomicSync = require('write-file-atomic').sync;
import type {Options as TransformOptions} from '../JSTransformer/worker/worker';
import type {Options as WorkerOptions} from '../JSTransformer/worker/worker';
import type {MappingsMap} from './SourceMap';
import type {Reporter} from './reporting';
@@ -58,7 +58,7 @@ function hashSourceCode(props: {
filePath: string,
sourceCode: string,
getTransformCacheKey: GetTransformCacheKey,
transformOptions: TransformOptions,
transformOptions: WorkerOptions,
transformOptionsKey: string,
}): string {
return crypto.createHash('sha1')
@@ -134,7 +134,7 @@ function writeSync(props: {
filePath: string,
sourceCode: string,
getTransformCacheKey: GetTransformCacheKey,
transformOptions: TransformOptions,
transformOptions: WorkerOptions,
transformOptionsKey: string,
result: CachedResult,
}): void {
@@ -326,7 +326,7 @@ function readMetadataFileSync(
export type ReadTransformProps = {
filePath: string,
sourceCode: string,
transformOptions: TransformOptions,
transformOptions: WorkerOptions,
transformOptionsKey: string,
getTransformCacheKey: GetTransformCacheKey,
cacheOptions: CacheOptions,