jscrambler-metro-plugin 8.4.19 → 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.
Files changed (2) hide show
  1. package/lib/sourceMaps.js +13 -13
  2. 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
- // retrieve debug ids after the validation by the sourcemap package
62
- // eslint-disable-next-line camelcase
63
- const { debugId, debug_id } = JSON.parse(metroSourceMap);
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
- if (debugId) {
166
- finalSourceMapsJson.debugId = debugId;
167
- }
168
- // eslint-disable-next-line camelcase
169
- if (debug_id) {
170
- // eslint-disable-next-line camelcase
171
- finalSourceMapsJson.debug_id = debug_id;
169
+
170
+ for (const param of metroSourceMapExtraParams) {
171
+ finalSourceMapsJson[param] = JSONMetroSourceMap[param];
172
172
  }
173
173
 
174
174
  return JSON.stringify(finalSourceMapsJson);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jscrambler-metro-plugin",
3
- "version": "8.4.19",
3
+ "version": "8.4.20",
4
4
  "description": "A plugin to use metro with Jscrambler Code Integrity",
5
5
  "exports": "./lib/index.js",
6
6
  "peerDependencies": {