mirror of https://github.com/status-im/metro.git
metro-buck: check validity of segments
Reviewed By: davidaurelio Differential Revision: D6496312 fbshipit-source-id: 586dc8d9f64d13cfddaf6bfe768e8f7b3442561a
This commit is contained in:
parent
d2075f3743
commit
86914666e5
|
@ -160,6 +160,11 @@ function unpackModuleId(
|
|||
}
|
||||
require.unpackModuleId = unpackModuleId;
|
||||
|
||||
function packModuleId(value: {segmentId: number, localId: number}): ModuleID {
|
||||
return value.segmentId << (ID_MASK_SHIFT + value.localId);
|
||||
}
|
||||
require.packModuleId = packModuleId;
|
||||
|
||||
function loadModuleImplementation(moduleId, module) {
|
||||
const nativeRequire = global.nativeRequire;
|
||||
if (!module && nativeRequire) {
|
||||
|
|
|
@ -66,15 +66,21 @@ exports[`basic_bundle bundles package with polyfills 1`] = `
|
|||
|
||||
_require.unpackModuleId = unpackModuleId;
|
||||
|
||||
function packModuleId(value) {
|
||||
return value.segmentId << ID_MASK_SHIFT + value.localId;
|
||||
}
|
||||
|
||||
_require.packModuleId = packModuleId;
|
||||
|
||||
function loadModuleImplementation(moduleId, module) {
|
||||
var nativeRequire = global.nativeRequire;
|
||||
|
||||
if (!module && nativeRequire) {
|
||||
var _unpackModuleId = unpackModuleId(moduleId),
|
||||
segmentId = _unpackModuleId.segmentId,
|
||||
localId = _unpackModuleId.localId;
|
||||
_segmentId = _unpackModuleId.segmentId,
|
||||
_localId = _unpackModuleId.localId;
|
||||
|
||||
nativeRequire(localId, segmentId);
|
||||
nativeRequire(_localId, _segmentId);
|
||||
module = modules[moduleId];
|
||||
}
|
||||
|
||||
|
@ -251,15 +257,21 @@ exports[`basic_bundle bundles package without polyfills 1`] = `
|
|||
|
||||
_require.unpackModuleId = unpackModuleId;
|
||||
|
||||
function packModuleId(value) {
|
||||
return value.segmentId << ID_MASK_SHIFT + value.localId;
|
||||
}
|
||||
|
||||
_require.packModuleId = packModuleId;
|
||||
|
||||
function loadModuleImplementation(moduleId, module) {
|
||||
var nativeRequire = global.nativeRequire;
|
||||
|
||||
if (!module && nativeRequire) {
|
||||
var _unpackModuleId = unpackModuleId(moduleId),
|
||||
segmentId = _unpackModuleId.segmentId,
|
||||
localId = _unpackModuleId.localId;
|
||||
_segmentId = _unpackModuleId.segmentId,
|
||||
_localId = _unpackModuleId.localId;
|
||||
|
||||
nativeRequire(localId, segmentId);
|
||||
nativeRequire(_localId, _segmentId);
|
||||
module = modules[moduleId];
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue