diff --git a/react-packager/src/node-haste/Module.js b/react-packager/src/node-haste/Module.js index 864846ae..e8ca4634 100644 --- a/react-packager/src/node-haste/Module.js +++ b/react-packager/src/node-haste/Module.js @@ -56,6 +56,17 @@ export type FastFs = { }; export type DepGraphHelpers = {isNodeModulesDir: (filePath: string) => boolean}; +export type ConstructorArgs = { + file: string, + fastfs: FastFs, + moduleCache: ModuleCache, + cache: Cache, + extractor: Extractor, + transformCode: TransformCode, + depGraphHelpers: DepGraphHelpers, + options: Options, +}; + class Module { path: string; @@ -81,16 +92,7 @@ class Module { transformCode, depGraphHelpers, options, - }: { - file: string, - fastfs: FastFs, - moduleCache: ModuleCache, - cache: Cache, - extractor: Extractor, - transformCode: TransformCode, - depGraphHelpers: DepGraphHelpers, - options: Options, - }) { + }: ConstructorArgs) { if (!isAbsolutePath(file)) { throw new Error('Expected file to be absolute path but got ' + file); } diff --git a/react-packager/src/node-haste/ModuleCache.js b/react-packager/src/node-haste/ModuleCache.js index 4cdee481..4377ac84 100644 --- a/react-packager/src/node-haste/ModuleCache.js +++ b/react-packager/src/node-haste/ModuleCache.js @@ -137,6 +137,7 @@ class ModuleCache { } createPolyfill({file}: {file: string}) { + /* $FlowFixMe: there are missing arguments. */ return new Polyfill({ file, cache: this._cache, diff --git a/react-packager/src/node-haste/Polyfill.js b/react-packager/src/node-haste/Polyfill.js index b2578f02..8a282520 100644 --- a/react-packager/src/node-haste/Polyfill.js +++ b/react-packager/src/node-haste/Polyfill.js @@ -1,9 +1,29 @@ +/** + * Copyright (c) 2013-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'; const Module = require('./Module'); +import type {ConstructorArgs} from './Module'; + class Polyfill extends Module { - constructor(options) { + + _id: string; + _dependencies: Array; + + constructor(options: ConstructorArgs & { + id: string, + dependencies: Array, + }) { super(options); this._id = options.id; this._dependencies = options.dependencies;