Merge pull request #889 from javascript-obfuscator/top-level-await-support

Added support of `top-level await`
This commit is contained in:
Timofey Kachalov
2021-02-28 20:01:35 +03:00
committed by GitHub
8 changed files with 31 additions and 4 deletions
+4
View File
@@ -1,5 +1,9 @@
Change Log
v2.10.6
---
* Added support of `top-level await`. Fixed https://github.com/javascript-obfuscator/javascript-obfuscator/issues/884
v2.10.5
---
* Fixed invalid code generation for rest arguments when `controlFlowFlattening` option is enabled. Fixed https://github.com/javascript-obfuscator/javascript-obfuscator/issues/887
+1 -1
View File
File diff suppressed because one or more lines are too long
+1 -1
View File
File diff suppressed because one or more lines are too long
+1 -1
View File
File diff suppressed because one or more lines are too long
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "javascript-obfuscator",
"version": "2.10.5",
"version": "2.10.6",
"description": "JavaScript obfuscator",
"keywords": [
"obfuscator",
+1
View File
@@ -65,6 +65,7 @@ export class ASTParserFacade {
const comments: ESTree.Comment[] = [];
const config: acorn.Options = {
...inputConfig,
allowAwaitOutsideFunction: true,
onComment: comments,
sourceType
};
@@ -779,6 +779,27 @@ describe('JavaScriptObfuscator', () => {
});
});
describe('Top-level await support', () => {
const regExp: RegExp = /await 0x1;/;
let obfuscatedCode: string;
beforeEach(() => {
const code: string = readFileAsString(__dirname + '/fixtures/top-level-await-support.js');
obfuscatedCode = JavaScriptObfuscator.obfuscate(
code,
{
...NO_ADDITIONAL_NODES_PRESET
}
).getObfuscatedCode();
});
it('should support top-level await', () => {
assert.match(obfuscatedCode, regExp);
});
});
describe('mangled identifier names generator', () => {
const regExp: RegExp = /var c *= *0x1/;