mirror of
https://github.com/javascript-obfuscator/javascript-obfuscator
synced 2026-08-09 12:42:29 +00:00
Vendored
+15
@@ -0,0 +1,15 @@
|
||||
declare module 'threads' {
|
||||
type PostMessage <U> = (data: U) => void;
|
||||
type SpawnCallback <T, U> = (data: T, postMessage: PostMessage <U>) => void;
|
||||
type ResponseCallback <U> = (response: U) => void;
|
||||
|
||||
class Thread <T, U> {
|
||||
public killed: boolean;
|
||||
|
||||
public send (data: T): Thread <T, U>;
|
||||
public on (eventType: string, responseCallback: ResponseCallback<U>): Thread <T, U>;
|
||||
public kill (): void;
|
||||
}
|
||||
|
||||
export function spawn <T, U> (spawnCallback: SpawnCallback <T, U>): Thread <T, U>;
|
||||
}
|
||||
@@ -3,6 +3,7 @@ export enum NodeType {
|
||||
ArrowFunctionExpression = 'ArrowFunctionExpression',
|
||||
AssignmentExpression = 'AssignmentExpression',
|
||||
AssignmentPattern = 'AssignmentPattern',
|
||||
AwaitExpression = 'AwaitExpression',
|
||||
BinaryExpression = 'BinaryExpression',
|
||||
BlockStatement = 'BlockStatement',
|
||||
BreakStatement = 'BreakStatement',
|
||||
|
||||
+2
-1
@@ -174,7 +174,8 @@ export class DeadCodeInjectionTransformer extends AbstractNodeTransformer {
|
||||
if (
|
||||
nestedBlockStatementsCount > DeadCodeInjectionTransformer.maxNestedBlockStatementsCount ||
|
||||
NodeGuards.isBreakStatementNode(node) ||
|
||||
NodeGuards.isContinueStatementNode(node)
|
||||
NodeGuards.isContinueStatementNode(node) ||
|
||||
NodeGuards.isAwaitExpressionNode(node)
|
||||
) {
|
||||
isValidBlockStatementNode = false;
|
||||
|
||||
|
||||
@@ -21,6 +21,14 @@ export class NodeGuards {
|
||||
return node.type === NodeType.AssignmentPattern;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {Node} node
|
||||
* @returns {boolean}
|
||||
*/
|
||||
public static isAwaitExpressionNode (node: ESTree.Node): node is ESTree.AwaitExpression {
|
||||
return node.type === NodeType.AwaitExpression;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {Node} node
|
||||
* @returns {boolean}
|
||||
|
||||
+1
-1
@@ -5,7 +5,7 @@ export function DebugProtectionFunctionCallTemplate (): string {
|
||||
return `
|
||||
(function () {
|
||||
var regExp1 = new RegExp('function *\\\\( *\\\\)');
|
||||
var regExp2 = new RegExp('\\\\+\\\\+ *_0x([a-f0-9]){4,6}');
|
||||
var regExp2 = new RegExp('\\\\+\\\\+ *\\(?:_0x([a-f0-9]){4,6}|\\\\b[a-zA-Z]{1,2}\\\\b\\)');
|
||||
var result = {debugProtectionFunctionName}('init');
|
||||
|
||||
if (!regExp1.test(result + 'chain') || !regExp2.test(result + 'input')) {
|
||||
|
||||
Reference in New Issue
Block a user