Skip to content

Commit

Permalink
feat: introduce experimentalOptions field
Browse files Browse the repository at this point in the history
  • Loading branch information
luiscubal committed May 29, 2024
1 parent 0f4a13c commit 5711ff8
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 2 deletions.
14 changes: 14 additions & 0 deletions .changeset/angry-badgers-flow.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
"jscrambler": minor
"ember-cli-jscrambler": minor
"grunt-jscrambler": minor
"gulp-jscrambler": minor
"jscrambler-metro-plugin": minor
"jscrambler-webpack-plugin": minor
---

New feature: experimentalOptions.

Users can pass experimental features through this field to our API.
The exact features aren't publicly documented. The expectation is that users are using these flags only
when advised to by our support team.
2 changes: 2 additions & 0 deletions packages/jscrambler-cli/src/bin/jscrambler.js
Original file line number Diff line number Diff line change
Expand Up @@ -411,6 +411,7 @@ const {
forceAppEnvironment,
beforeProtection,
deleteProtectionOnSuccess,
experimentalOptions,
} = config;

const params = config.params;
Expand Down Expand Up @@ -549,6 +550,7 @@ if (commander.sourceMaps) {
forceAppEnvironment,
beforeProtection,
deleteProtectionOnSuccess,
experimentalOptions,
};
try {
if (typeof werror !== 'undefined') {
Expand Down
10 changes: 9 additions & 1 deletion packages/jscrambler-cli/src/cleanup-input-fields.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,15 @@ export default function cleanupInputFields(args, fragments, options = {}) {
}
}

['tolerateMinification', 'useProfilingData', 'useAppClassification', 'inputSymbolTable', 'entryPoint', 'ensureCodeAnnotation'].forEach(fieldCleanUp);
[
'tolerateMinification',
'useProfilingData',
'useAppClassification',
'inputSymbolTable',
'entryPoint',
'ensureCodeAnnotation',
'experimentalOptions',
].forEach(fieldCleanUp);

return [options, cleanedUpFragments];
}
6 changes: 5 additions & 1 deletion packages/jscrambler-cli/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -448,7 +448,7 @@ export default {
source,
tolerateMinification,
numberOfProtections,
forceAppEnvironment
forceAppEnvironment,
};

if (finalConfig.inputSymbolTable) {
Expand All @@ -459,6 +459,10 @@ export default {
protectionOptions.inputSymbolTable = inputSymbolTableContents;
}

if (finalConfig.experimentalOptions) {
protectionOptions.experimentalOptions = finalConfig.experimentalOptions;
}

const createApplicationProtectionRes = await this.createApplicationProtections(
client,
applicationId,
Expand Down

0 comments on commit 5711ff8

Please sign in to comment.