jscrambler-metro-plugin 8.4.26 → 8.4.27
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/utils.js +9 -8
- package/package.json +1 -1
package/lib/utils.js
CHANGED
@@ -2,6 +2,7 @@ const fs = require('fs');
|
|
2
2
|
const readline = require('readline');
|
3
3
|
const {Command} = require('commander');
|
4
4
|
const {Readable} = require('stream');
|
5
|
+
const { sep } = require('path');
|
5
6
|
const metroSourceMap = require('metro-source-map');
|
6
7
|
const {
|
7
8
|
JSCRAMBLER_EXTS,
|
@@ -209,11 +210,11 @@ function buildNormalizePath(path, projectRoot) {
|
|
209
210
|
return;
|
210
211
|
}
|
211
212
|
const relativePath = path.replace(projectRoot, '');
|
212
|
-
|
213
|
-
if (
|
214
|
-
|
213
|
+
let relativePathWithLeadingSlash = relativePath.replace(JSCRAMBLER_EXTS, '.js');
|
214
|
+
if (relativePathWithLeadingSlash.startsWith(sep)) {
|
215
|
+
relativePathWithLeadingSlash = relativePathWithLeadingSlash.substring(1 /* remove leading separator */);
|
215
216
|
}
|
216
|
-
return relativePathWithLeadingSlash.
|
217
|
+
return relativePathWithLeadingSlash.replace(/\\/g, '/'); // replace win32 separator by linux one
|
217
218
|
}
|
218
219
|
|
219
220
|
function getCodeBody(code) {
|
@@ -264,7 +265,7 @@ function handleExcludeList(config, {supportsExcludeList, excludeList}) {
|
|
264
265
|
// add excludeList to gvi in case the api does not support global excludeList
|
265
266
|
if (Array.isArray(config.params)) {
|
266
267
|
const gvi = config.params.find(
|
267
|
-
|
268
|
+
(param) => param.name === JSCRAMBLER_GLOBAL_VARIABLE_INDIRECTION
|
268
269
|
);
|
269
270
|
if (gvi) {
|
270
271
|
gvi.options = gvi.options || {};
|
@@ -280,14 +281,14 @@ function handleExcludeList(config, {supportsExcludeList, excludeList}) {
|
|
280
281
|
function injectTolerateBegninPoisoning(config) {
|
281
282
|
if (Array.isArray(config.params)) {
|
282
283
|
const sd = config.params.find(
|
283
|
-
|
284
|
+
(param) => param.name === JSCRAMBLER_SELF_DEFENDING
|
284
285
|
);
|
285
286
|
if (sd) {
|
286
287
|
sd.options = sd.options || {};
|
287
288
|
sd.options.options = sd.options.options || [];
|
288
289
|
if (
|
289
|
-
|
290
|
-
|
290
|
+
Array.isArray(sd.options.options) &&
|
291
|
+
!sd.options.options.includes(JSCRAMBLER_TOLERATE_BENIGN_POISONING)
|
291
292
|
) {
|
292
293
|
console.log(`info Jscrambler Tolerate benign poisoning option was automatically added to Self-Defending.`);
|
293
294
|
sd.options.options.push(JSCRAMBLER_TOLERATE_BENIGN_POISONING)
|