mirror of https://github.com/status-im/metro.git
metro sourcemap add x_metro_module_paths
Reviewed By: davidaurelio Differential Revision: D6593737 fbshipit-source-id: 3a642d77146308a9df19e16cddfcd0f91cb9d203
This commit is contained in:
parent
5eeb88f5a9
commit
a66e1f71f6
|
@ -23,7 +23,10 @@ export type IndexMapSection = {
|
||||||
|
|
||||||
export type RawMappings = Array<RawMapping>;
|
export type RawMappings = Array<RawMapping>;
|
||||||
|
|
||||||
type FBExtensions = {x_facebook_offsets: Array<number>};
|
type FBExtensions = {
|
||||||
|
x_facebook_offsets: Array<number>,
|
||||||
|
x_metro_module_paths: Array<string>,
|
||||||
|
};
|
||||||
|
|
||||||
export type {MappingsMap};
|
export type {MappingsMap};
|
||||||
export type IndexMap = {
|
export type IndexMap = {
|
||||||
|
|
|
@ -41,11 +41,22 @@ module.exports = ({
|
||||||
sourcePath: '',
|
sourcePath: '',
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Add map of module id -> source to sourcemap
|
||||||
|
const module_paths = [];
|
||||||
|
startupModules.forEach(m => {
|
||||||
|
module_paths[m.id] = m.sourcePath;
|
||||||
|
});
|
||||||
|
lazyModules.forEach(m => {
|
||||||
|
module_paths[m.id] = m.sourcePath;
|
||||||
|
});
|
||||||
|
|
||||||
const map = combineSourceMapsAddingOffsets(
|
const map = combineSourceMapsAddingOffsets(
|
||||||
[startupModule].concat(lazyModules),
|
[startupModule].concat(lazyModules),
|
||||||
|
module_paths,
|
||||||
moduleGroups,
|
moduleGroups,
|
||||||
options,
|
options,
|
||||||
);
|
);
|
||||||
delete map.x_facebook_offsets[Number.MIN_SAFE_INTEGER];
|
delete map.x_facebook_offsets[Number.MIN_SAFE_INTEGER];
|
||||||
|
|
||||||
return map;
|
return map;
|
||||||
};
|
};
|
||||||
|
|
|
@ -66,6 +66,7 @@ function combineSourceMaps(
|
||||||
|
|
||||||
function combineSourceMapsAddingOffsets(
|
function combineSourceMapsAddingOffsets(
|
||||||
modules: $ReadOnlyArray<ModuleTransportLike | RamModule>,
|
modules: $ReadOnlyArray<ModuleTransportLike | RamModule>,
|
||||||
|
x_metro_module_paths: Array<string>,
|
||||||
moduleGroups?: ?ModuleGroups,
|
moduleGroups?: ?ModuleGroups,
|
||||||
options?: ?CombineOptions,
|
options?: ?CombineOptions,
|
||||||
): FBIndexMap {
|
): FBIndexMap {
|
||||||
|
@ -76,7 +77,7 @@ function combineSourceMapsAddingOffsets(
|
||||||
moduleGroups,
|
moduleGroups,
|
||||||
options,
|
options,
|
||||||
);
|
);
|
||||||
return {sections, version: 3, x_facebook_offsets};
|
return {sections, version: 3, x_facebook_offsets, x_metro_module_paths};
|
||||||
}
|
}
|
||||||
|
|
||||||
function combineMaps(
|
function combineMaps(
|
||||||
|
|
Loading…
Reference in New Issue