jscrambler-metro-plugin 8.4.50 → 8.5.0

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/index.js CHANGED
@@ -324,8 +324,17 @@ module.exports = function (_config = {}, projectRoot = process.cwd()) {
324
324
  }`,
325
325
  );
326
326
 
327
+ const isCodeHardeningThresholdSupported =
328
+ await jscrambler.introspectFieldOnMethod.call(
329
+ jscrambler,
330
+ config,
331
+ 'mutation',
332
+ 'createApplicationProtection',
333
+ 'codeHardeningThreshold',
334
+ );
335
+
327
336
  // check for incompatible transformations and turn off code hardening
328
- handleHermesIncompatibilities(config);
337
+ handleHermesIncompatibilities(config, isCodeHardeningThresholdSupported);
329
338
 
330
339
  // start obfuscation
331
340
  await obfuscateBundle(bundlePath, {fileNames: Array.from(fileNames), entryPointCode}, sourceMapFiles, config, projectRoot);
package/lib/utils.js CHANGED
@@ -358,17 +358,23 @@ function addHermesShowSourceDirective(config) {
358
358
 
359
359
  /**
360
360
  * @param config
361
+ * @param isCodeHardeningThresholdSupported
361
362
  * @exception {Error} If an incompatible transformation was selected
362
363
  */
363
- function handleHermesIncompatibilities(config) {
364
+ function handleHermesIncompatibilities(
365
+ config,
366
+ isCodeHardeningThresholdSupported,
367
+ ) {
364
368
  if (!config.enabledHermes) {
365
369
  return;
366
370
  }
367
371
 
368
- if (config.codeHardeningThreshold === undefined) {
369
- console.log(`info Jscrambler Code Hardening ignored, as it is incompatible with hermes engine.`);
372
+ if (isCodeHardeningThresholdSupported) {
373
+ if (config.codeHardeningThreshold === undefined) {
374
+ console.log(`info Jscrambler Code Hardening ignored, as it is incompatible with hermes engine.`);
375
+ }
376
+ config.codeHardeningThreshold = 999999999;
370
377
  }
371
- config.codeHardeningThreshold = 999999999;
372
378
 
373
379
  for (const {
374
380
  slugName,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jscrambler-metro-plugin",
3
- "version": "8.4.50",
3
+ "version": "8.5.0",
4
4
  "description": "A plugin to use metro with Jscrambler Code Integrity",
5
5
  "exports": "./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": "8.11.3"
12
+ "jscrambler": "8.12.0"
13
13
  },
14
14
  "keywords": [
15
15
  "jscrambler",