Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion dist/index.browser.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/index.cli.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/index.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "javascript-obfuscator",
"version": "2.10.5",
"version": "2.10.6",
"description": "JavaScript obfuscator",
"keywords": [
"obfuscator",
Expand Down
1 change: 1 addition & 0 deletions src/ASTParserFacade.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ export class ASTParserFacade {
const comments: ESTree.Comment[] = [];
const config: acorn.Options = {
...inputConfig,
allowAwaitOutsideFunction: true,
onComment: comments,
sourceType
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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/;

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
await 1;