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
This commit is contained in:
David Aurelio 2017-05-23 10:25:00 -07:00 committed by Facebook Github Bot
parent f9f1245560
commit 9a91ea4b36
2 changed files with 6 additions and 6 deletions

View File

@ -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) => {

View File

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