jscrambler-metro-plugin 8.5.0 → 9.0.1

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/README.md CHANGED
@@ -11,10 +11,11 @@ Version Compatibility
11
11
  The version's compatibility table match your [Jscrambler Version](https://app.jscrambler.com/settings) with the Jscrambler Metro Plugin.
12
12
  Please make sure you install the right version, otherwise some functionalities might not work properly.
13
13
 
14
- | _Jscrambler Version_ | _Client and Integrations_ |
15
- |:----------:|:-------------:|
16
- | _<= 7.1_ | _<= 5.x.x_ |
17
- | _\>= 7.2_ | _\>= 6.0.0_ |
14
+ | _Jscrambler Version_ | _Client and Integrations_ |
15
+ |:--------------------:|:-------------------------:|
16
+ | _<= 7.1_ | _<= 5.x.x_ |
17
+ | _\>= 7.2_ | _\>= 6.0.0 <=8.5.0_ |
18
+ | _\>= 8.6_ | _\>= 9.0.0_ |
18
19
 
19
20
  # Usage
20
21
 
package/lib/index.js CHANGED
@@ -4,6 +4,7 @@ const fs = require('fs');
4
4
  const path = require('path');
5
5
  const generateSourceMaps = require('./sourceMaps');
6
6
  const globalThisPolyfill = require('./polyfills/globalThis');
7
+ const { version } = require('../package.json');
7
8
 
8
9
  const {
9
10
  INIT_CORE_MODULE,
@@ -48,7 +49,7 @@ function logSourceMapsWarning(hasMetroSourceMaps, hasJscramblerSourceMaps) {
48
49
 
49
50
  async function obfuscateBundle(
50
51
  {bundlePath, bundleSourceMapPath},
51
- {fileNames, entryPointCode},
52
+ {fileNames, entryPointCode, isCodeHardeningThresholdSupported},
52
53
  sourceMapFiles,
53
54
  config,
54
55
  projectRoot
@@ -134,6 +135,7 @@ async function obfuscateBundle(
134
135
  config.sources = sources;
135
136
  config.filesDest = JSCRAMBLER_DIST_TEMP_FOLDER;
136
137
  config.clientId = JSCRAMBLER_CLIENT_ID;
138
+ config.clientVersion = version;
137
139
 
138
140
  const supportsExcludeList = await jscrambler.introspectFieldOnMethod.call(
139
141
  jscrambler,
@@ -163,7 +165,10 @@ async function obfuscateBundle(
163
165
  processedMetroBundle,
164
166
  );
165
167
 
166
- const addShowSource = addHermesShowSourceDirective(config);
168
+ const addShowSource = addHermesShowSourceDirective(
169
+ config,
170
+ isCodeHardeningThresholdSupported,
171
+ );
167
172
 
168
173
  if (addShowSource) {
169
174
  console.log(
@@ -337,7 +342,7 @@ module.exports = function (_config = {}, projectRoot = process.cwd()) {
337
342
  handleHermesIncompatibilities(config, isCodeHardeningThresholdSupported);
338
343
 
339
344
  // start obfuscation
340
- await obfuscateBundle(bundlePath, {fileNames: Array.from(fileNames), entryPointCode}, sourceMapFiles, config, projectRoot);
345
+ await obfuscateBundle(bundlePath, {fileNames: Array.from(fileNames), entryPointCode, isCodeHardeningThresholdSupported}, sourceMapFiles, config, projectRoot);
341
346
  } catch(err) {
342
347
  console.error(err);
343
348
  process.exit(1);
package/lib/utils.js CHANGED
@@ -337,13 +337,23 @@ function handleAntiTampering(config, processedMetroBundle) {
337
337
 
338
338
  /**
339
339
  * @param {object} config
340
+ * @param {boolean} [isCodeHardeningThresholdSupported]
340
341
  * @returns {boolean} if true 'show source' directive is added
341
342
  */
342
- function addHermesShowSourceDirective(config) {
343
+ function addHermesShowSourceDirective(
344
+ config,
345
+ isCodeHardeningThresholdSupported,
346
+ ) {
343
347
  if (!config.enabledHermes) {
344
348
  return false;
345
349
  }
346
350
 
351
+ // when not supported, means that the engine is using the newer
352
+ // version of code hardening, so show source directive is mandatory
353
+ if (!isCodeHardeningThresholdSupported) {
354
+ return true;
355
+ }
356
+
347
357
  for (const slugName of JSCRAMBLER_HERMES_ADD_SHOW_SOURCE_DIRECTIVE) {
348
358
  if (Array.isArray(config.params)) {
349
359
  const showSource = config.params.find((param) => param.name === slugName);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jscrambler-metro-plugin",
3
- "version": "8.5.0",
3
+ "version": "9.0.1",
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.12.0"
12
+ "jscrambler": "8.15.0"
13
13
  },
14
14
  "keywords": [
15
15
  "jscrambler",