mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-05-06 17:52:57 +08:00
Summary: Replaces all usages of `Array<ModuleTransportLike>` with `$ReadOnlyArray<ModuleTransportLike>` Reviewed By: jeanlauliac Differential Revision: D5111714 fbshipit-source-id: 9b531576362172ecf5c0adfc9c01a16c8946b476
41 lines
1.2 KiB
JavaScript
41 lines
1.2 KiB
JavaScript
/**
|
|
* Copyright (c) 2015-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 {combineSourceMaps, combineSourceMapsAddingOffsets, joinModules} = require('./util');
|
|
|
|
import type {ModuleGroups, ModuleTransportLike} from '../../types.flow';
|
|
|
|
type Params = {
|
|
fixWrapperOffset: boolean,
|
|
lazyModules: $ReadOnlyArray<ModuleTransportLike>,
|
|
moduleGroups?: ModuleGroups,
|
|
startupModules: $ReadOnlyArray<ModuleTransportLike>,
|
|
};
|
|
|
|
module.exports = ({fixWrapperOffset, lazyModules, moduleGroups, startupModules}: Params) => {
|
|
const options = fixWrapperOffset ? {fixWrapperOffset: true} : undefined;
|
|
const startupModule: ModuleTransportLike = {
|
|
code: joinModules(startupModules),
|
|
id: Number.MIN_SAFE_INTEGER,
|
|
map: combineSourceMaps(startupModules, undefined, options),
|
|
sourcePath: '',
|
|
};
|
|
|
|
const map = combineSourceMapsAddingOffsets(
|
|
[startupModule].concat(lazyModules),
|
|
moduleGroups,
|
|
options,
|
|
);
|
|
delete map.x_facebook_offsets[Number.MIN_SAFE_INTEGER];
|
|
return map;
|
|
};
|