jscrambler-metro-plugin 8.4.18 → 8.4.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/sourceMaps.js +13 -13
- package/package.json +1 -1
package/lib/sourceMaps.js
CHANGED
@@ -58,9 +58,16 @@ module.exports = async function generateSourceMaps(payload) {
|
|
58
58
|
const metroSourceMapConsumer = new sourceMap.SourceMapConsumer(
|
59
59
|
metroSourceMap,
|
60
60
|
);
|
61
|
-
//
|
62
|
-
|
63
|
-
|
61
|
+
// extra source map params that are not processed by the source-map package
|
62
|
+
const metroSourceMapExtraParams = [
|
63
|
+
'x_facebook_sources', // added x_facebook_sources to prevent the third party sources to come back with null values
|
64
|
+
// for when react native debugIds are necessary in the sourcemaps (upload to sentry for example)
|
65
|
+
// needs to be added at the end of this file since the debugIds are not in SourceMapGenerator type
|
66
|
+
'debugId',
|
67
|
+
'debug_id',
|
68
|
+
];
|
69
|
+
// retrieve debug ids and facebook sources after the validation by the sourcemap package
|
70
|
+
const JSONMetroSourceMap = JSON.parse(metroSourceMap);
|
64
71
|
const finalSourceMapGenerator = new sourceMap.SourceMapGenerator({
|
65
72
|
file: bundlePath,
|
66
73
|
});
|
@@ -158,17 +165,10 @@ module.exports = async function generateSourceMaps(payload) {
|
|
158
165
|
})
|
159
166
|
|
160
167
|
const finalSourceMaps = finalSourceMapGenerator.toString();
|
161
|
-
|
162
|
-
// for when react native debugIds are necessary in the sourcemaps (upload to sentry for example)
|
163
|
-
// needs to be added in the end since the debugIds are not in SourceMapGenerator type
|
164
168
|
const finalSourceMapsJson = JSON.parse(finalSourceMaps);
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
// eslint-disable-next-line camelcase
|
169
|
-
if (debug_id) {
|
170
|
-
// eslint-disable-next-line camelcase
|
171
|
-
finalSourceMapsJson.debugId = debug_id;
|
169
|
+
|
170
|
+
for (const param of metroSourceMapExtraParams) {
|
171
|
+
finalSourceMapsJson[param] = JSONMetroSourceMap[param];
|
172
172
|
}
|
173
173
|
|
174
174
|
return JSON.stringify(finalSourceMapsJson);
|