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:
parent
f9f1245560
commit
9a91ea4b36
|
@ -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 = {
|
||||
|
|
Loading…
Reference in New Issue