Permalink
Browse files

Use `ModuleTransportLike` only with `$ReadOnlyArray`

Summary: Replaces all usages of `Array<ModuleTransportLike>` with `$ReadOnlyArray<ModuleTransportLike>`

Reviewed By: jeanlauliac

Differential Revision: D5111714

fbshipit-source-id: 9b531576362172ecf5c0adfc9c01a16c8946b476
  • Loading branch information...
davidaurelio authored and facebook-github-bot committed May 23, 2017
1 parent f9f1245 commit 9a91ea4b3653f76300e34f0060dbc637bb8af09f
@@ -16,9 +16,9 @@ import type {ModuleGroups, ModuleTransportLike} from '../../types.flow';
type Params = {
fixWrapperOffset: boolean,
lazyModules: Array<ModuleTransportLike>,
lazyModules: $ReadOnlyArray<ModuleTransportLike>,
moduleGroups?: ModuleGroups,
startupModules: Array<ModuleTransportLike>,
startupModules: $ReadOnlyArray<ModuleTransportLike>,
};
module.exports = ({fixWrapperOffset, lazyModules, moduleGroups, startupModules}: Params) => {
@@ -46,7 +46,7 @@ const Section =
type CombineOptions = {fixWrapperOffset: boolean};
function combineSourceMaps(
modules: Array<ModuleTransportLike>,
modules: $ReadOnlyArray<ModuleTransportLike>,
moduleGroups?: ModuleGroups,
options?: ?CombineOptions,
): IndexMap {
@@ -55,7 +55,7 @@ function combineSourceMaps(
}
function combineSourceMapsAddingOffsets(
modules: Array<ModuleTransportLike>,
modules: $ReadOnlyArray<ModuleTransportLike>,
moduleGroups?: ModuleGroups,
options?: ?CombineOptions,
): FBIndexMap {
@@ -85,7 +85,7 @@ function combineMaps(modules, offsets: ?Array<number>, moduleGroups, options) {
group = moduleGroups && moduleGroups.groups.get(id);
if (group && moduleGroups) {
const {modulesById} = moduleGroups;
const otherModules: Array<ModuleTransportLike> =
const otherModules: $ReadOnlyArray<ModuleTransportLike> =
Array.from(group || [])
.map(moduleId => modulesById.get(moduleId))
.filter(Boolean); // needed to appease flow
@@ -116,7 +116,7 @@ function combineMaps(modules, offsets: ?Array<number>, moduleGroups, options) {
}
const joinModules =
(modules: Array<*>): string =>
(modules: $ReadOnlyArray<{+code: string}>): string =>
modules.map(m => m.code).join('\n');
module.exports = {

0 comments on commit 9a91ea4

Please sign in to comment.