javascript-obfuscator 5.2.0 → 5.2.1

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "javascript-obfuscator",
3
- "version": "5.2.0",
3
+ "version": "5.2.1",
4
4
  "description": "JavaScript obfuscator",
5
5
  "keywords": [
6
6
  "obfuscator",
@@ -7,14 +7,17 @@ export declare abstract class AbstractIdentifierNamesGenerator implements IIdent
7
7
  protected readonly randomGenerator: IRandomGenerator;
8
8
  protected readonly preservedNamesSet: Set<string>;
9
9
  protected readonly lexicalScopesPreservedNamesMap: WeakMap<TNodeWithLexicalScope, Set<string>>;
10
+ protected readonly allLexicalScopePreservedNames: Set<string>;
10
11
  constructor(randomGenerator: IRandomGenerator, options: IOptions);
11
12
  generate(lexicalScopeNode: TNodeWithLexicalScope, nameLength?: number): string;
12
13
  preserveName(name: string): void;
13
14
  preserveNameForLexicalScope(name: string, lexicalScopeNode: TNodeWithLexicalScope): void;
14
15
  isValidIdentifierName(name: string): boolean;
15
16
  isValidIdentifierNameInLexicalScopes(name: string, lexicalScopeNodes: TNodeWithLexicalScope[]): boolean;
17
+ isValidIdentifierNameInAllScopes(name: string): boolean;
16
18
  private isReservedName;
17
19
  abstract generateForGlobalScope(nameLength?: number): string;
20
+ abstract generateForGlobalScopeWithAllScopesValidation(nameLength?: number): string;
18
21
  abstract generateForLexicalScope(lexicalScopeNode: TNodeWithLexicalScope, nameLength?: number): string;
19
22
  abstract generateForLabel(label: string, nameLength?: number): string;
20
23
  abstract generateNext(nameLength?: number): string;
@@ -11,8 +11,10 @@ export declare class DictionaryIdentifierNamesGenerator extends AbstractIdentifi
11
11
  private static incrementIdentifierName;
12
12
  generateNext(): string;
13
13
  generateForGlobalScope(): string;
14
+ generateForGlobalScopeWithAllScopesValidation(): string;
14
15
  generateForLexicalScope(lexicalScopeNode: TNodeWithLexicalScope): string;
15
16
  generateForLabel(label: string): string;
17
+ private generateForGlobalScopeInternal;
16
18
  private generateNewDictionaryName;
17
19
  private getInitialIdentifierNames;
18
20
  private getIncrementedIdentifierNames;
@@ -7,6 +7,9 @@ export declare class HexadecimalIdentifierNamesGenerator extends AbstractIdentif
7
7
  constructor(randomGenerator: IRandomGenerator, options: IOptions);
8
8
  generateNext(nameLength?: number): string;
9
9
  generateForGlobalScope(nameLength?: number): string;
10
+ generateForGlobalScopeWithAllScopesValidation(nameLength?: number): string;
10
11
  generateForLexicalScope(lexicalScopeNode: TNodeWithLexicalScope, nameLength?: number): string;
11
12
  generateForLabel(label: string, nameLength?: number): string;
13
+ private generateForGlobalScopeInternal;
14
+ private generateNextName;
12
15
  }
@@ -15,6 +15,7 @@ export declare class MangledIdentifierNamesGenerator extends AbstractIdentifierN
15
15
  constructor(randomGenerator: IRandomGenerator, options: IOptions, setUtils: ISetUtils);
16
16
  generateNext(nameLength?: number): string;
17
17
  generateForGlobalScope(nameLength?: number): string;
18
+ generateForGlobalScopeWithAllScopesValidation(nameLength?: number): string;
18
19
  generateForLexicalScope(lexicalScopeNode: TNodeWithLexicalScope, nameLength?: number): string;
19
20
  generateForLabel(label: string, nameLength?: number): string;
20
21
  isIncrementedMangledName(nextName: string, prevName: string): boolean;
@@ -23,6 +24,7 @@ export declare class MangledIdentifierNamesGenerator extends AbstractIdentifierN
23
24
  protected updatePreviousMangledName(name: string): void;
24
25
  protected updatePreviousMangledNameForLabel(name: string, label: string, lastMangledNameForLabel: string): void;
25
26
  protected generateNewMangledName(previousMangledName: string, validationFunction?: (newIdentifierName: string) => boolean): string;
27
+ private generateForGlobalScopeInternal;
26
28
  private getLastMangledNameForScopes;
27
29
  private getLastMangledNameForLabel;
28
30
  }
@@ -7,6 +7,8 @@ export interface IIdentifierNamesGenerator {
7
7
  generateNext(nameLength?: number): string;
8
8
  isValidIdentifierName(identifierName: string): boolean;
9
9
  isValidIdentifierNameInLexicalScopes(identifierName: string, lexicalScopeNodes: TNodeWithLexicalScope[]): boolean;
10
+ isValidIdentifierNameInAllScopes(identifierName: string): boolean;
11
+ generateForGlobalScopeWithAllScopesValidation(nameLength?: number): string;
10
12
  preserveName(identifierName: string): void;
11
13
  preserveNameForLexicalScope(identifierName: string, lexicalScope: TNodeWithLexicalScope): void;
12
14
  }
@@ -45,6 +45,7 @@ export declare class NodeGuards {
45
45
  static isLabeledStatementNode(node: ESTree.Node): node is ESTree.LabeledStatement;
46
46
  static isLiteralNode(node: ESTree.Node): node is ESTree.Literal;
47
47
  static isLogicalExpressionNode(node: ESTree.Node): node is ESTree.LogicalExpression;
48
+ static isLoopStatementNode(node: ESTree.Node): node is ESTree.ForStatement | ESTree.ForInStatement | ESTree.ForOfStatement | ESTree.WhileStatement | ESTree.DoWhileStatement;
48
49
  static isMemberExpressionNode(node: ESTree.Node): node is ESTree.MemberExpression;
49
50
  static isMetaPropertyNode(node: ESTree.Node): node is ESTree.MetaProperty;
50
51
  static isMethodDefinitionNode(node: ESTree.Node): node is ESTree.MethodDefinition;
@@ -12,6 +12,7 @@ export declare class ObjectExpressionKeysTransformer extends AbstractNodeTransfo
12
12
  constructor(objectExpressionExtractorFactory: TObjectExpressionExtractorFactory, randomGenerator: IRandomGenerator, options: IOptions);
13
13
  private static checkProhibitedPatterns;
14
14
  private static isProhibitedObjectExpressionNode;
15
+ private static isProhibitedLoopBody;
15
16
  private static isProhibitedArrowFunctionExpression;
16
17
  private static isProhibitedSequenceExpression;
17
18
  getVisitor(nodeTransformationStage: NodeTransformationStage): IVisitor | null;