jscrambler-metro-plugin 5.5.34 → 6.0.3

Sign up to get free protection for your applications and to get access to all the features.
package/README.md CHANGED
@@ -2,6 +2,17 @@
2
2
 
3
3
  This metro plugin protects your **React Native** bundle using Jscrambler.
4
4
 
5
+ # Version Compatibility
6
+ ------------------------------------------------------------------------------
7
+
8
+ The version's compatibility table match your [Jscrambler Version](https://app.jscrambler.com/settings) with the Jscrambler Metro Plugin.
9
+ Please make sure you install the right version, otherwise some functionalities might not work properly.
10
+
11
+ | _Jscrambler Version_ | _Client and Integrations_ |
12
+ |:----------:|:-------------:|
13
+ | _<= 7.1_ | _<= 5.x.x_ |
14
+ | _\>= 7.2_ | _\>= 6.0.0_ |
15
+
5
16
  # Usage
6
17
 
7
18
  Include the plugin in your `metro.config.js` and add the following code:
package/lib/index.js CHANGED
@@ -256,6 +256,8 @@ module.exports = function (_config = {}, projectRoot = process.cwd()) {
256
256
  }
257
257
 
258
258
  const bundlePath = getBundlePath();
259
+ // make sure jscrambler-metro-plugin is properly configure on metro bundler
260
+ let calledByMetro = false;
259
261
  const fileNames = new Set();
260
262
  const sourceMapFiles = [];
261
263
  const config = Object.assign({}, jscrambler.config, _config);
@@ -272,6 +274,10 @@ module.exports = function (_config = {}, projectRoot = process.cwd()) {
272
274
 
273
275
  process.on('beforeExit', async function (exitCode) {
274
276
  try{
277
+ if (!calledByMetro) {
278
+ throw new Error('*jscrambler-metro-plugin* was not properly configured on metro.config.js file. Please verify our documentation in https://docs.jscrambler.com/code-integrity/frameworks-and-libraries/react-native/integration.');
279
+ }
280
+
275
281
  console.log(
276
282
  instrument
277
283
  ? 'info Jscrambler Instrumenting Code'
@@ -297,6 +303,8 @@ module.exports = function (_config = {}, projectRoot = process.cwd()) {
297
303
  * @returns {boolean}
298
304
  */
299
305
  processModuleFilter(_module) {
306
+ calledByMetro = true;
307
+
300
308
  const modulePath = _module.path;
301
309
  const shouldSkipModule = !validateModule(modulePath, config, projectRoot);
302
310
 
package/lib/utils.js CHANGED
@@ -225,10 +225,10 @@ const isFileReadable = (path) => new Promise((resolve) => {
225
225
  })
226
226
 
227
227
  const addBundleArgsToExcludeList = (chunk, excludeList) => {
228
- const regex = /\(([0-9a-zA-Z_,]+)\){$/gm;
228
+ const regex = /\(([0-9a-zA-Z_,$ ]+)\)[ ]?{$/gm;
229
229
  const m = regex.exec(chunk);
230
230
  if (Array.isArray(m) && m.length > 1) {
231
- for (const arg of m[1].split(",")) {
231
+ for (const arg of m[m.length - 1].split(",")) {
232
232
  if (!excludeList.includes(arg)) {
233
233
  excludeList.push(arg);
234
234
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jscrambler-metro-plugin",
3
- "version": "5.5.34",
3
+ "version": "6.0.3",
4
4
  "description": "A plugin to use metro with Jscrambler",
5
5
  "main": "lib/index.js",
6
6
  "peerDependencies": {
@@ -9,7 +9,7 @@
9
9
  "dependencies": {
10
10
  "commander": "^2.20.0",
11
11
  "fs-extra": "^8.0.1",
12
- "jscrambler": "^5.5.34"
12
+ "jscrambler": "^6.0.1"
13
13
  },
14
14
  "keywords": [
15
15
  "jscrambler",