javascript-obfuscator 3.2.4 → 4.0.0

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": "3.2.4",
3
+ "version": "4.0.0",
4
4
  "description": "JavaScript obfuscator",
5
5
  "keywords": [
6
6
  "obfuscator",
@@ -7,8 +7,9 @@ import { IRandomGenerator } from '../../interfaces/utils/IRandomGenerator';
7
7
  import { AbstractCustomCodeHelper } from '../AbstractCustomCodeHelper';
8
8
  export declare class DebugProtectionFunctionIntervalCodeHelper extends AbstractCustomCodeHelper {
9
9
  private debugProtectionFunctionName;
10
+ private debugProtectionInterval;
10
11
  constructor(identifierNamesGeneratorFactory: TIdentifierNamesGeneratorFactory, customCodeHelperFormatter: ICustomCodeHelperFormatter, customCodeHelperObfuscator: ICustomCodeHelperObfuscator, randomGenerator: IRandomGenerator, options: IOptions);
11
- initialize(debugProtectionFunctionName: string): void;
12
+ initialize(debugProtectionFunctionName: string, debugProtectionInterval: number): void;
12
13
  protected getNodeStructure(codeHelperTemplate: string): TStatement[];
13
14
  protected getCodeHelperTemplate(): string;
14
15
  }
@@ -40,6 +40,7 @@ export declare enum NodeType {
40
40
  NewExpression = "NewExpression",
41
41
  ObjectExpression = "ObjectExpression",
42
42
  ObjectPattern = "ObjectPattern",
43
+ PrivateIdentifier = "PrivateIdentifier",
43
44
  Program = "Program",
44
45
  Property = "Property",
45
46
  PropertyDefinition = "PropertyDefinition",
@@ -6,11 +6,11 @@ import { AbstractIdentifierNamesGenerator } from './AbstractIdentifierNamesGener
6
6
  export declare class MangledIdentifierNamesGenerator extends AbstractIdentifierNamesGenerator {
7
7
  private static readonly maxRegenerationAttempts;
8
8
  private static readonly initMangledNameCharacter;
9
- private static readonly lastMangledNameInScopeMap;
10
9
  private static readonly nameSequence;
11
10
  private static readonly reservedNamesSet;
11
+ private lastMangledName;
12
+ private readonly lastMangledNameForScopeMap;
12
13
  private readonly lastMangledNameForLabelMap;
13
- private previousMangledName;
14
14
  private readonly setUtils;
15
15
  constructor(randomGenerator: IRandomGenerator, options: IOptions, setUtils: ISetUtils);
16
16
  generateNext(nameLength?: number): string;
@@ -16,7 +16,7 @@ export interface IOptions {
16
16
  readonly deadCodeInjection: boolean;
17
17
  readonly deadCodeInjectionThreshold: number;
18
18
  readonly debugProtection: boolean;
19
- readonly debugProtectionInterval: boolean;
19
+ readonly debugProtectionInterval: number;
20
20
  readonly disableConsoleOutput: boolean;
21
21
  readonly domainLock: string[];
22
22
  readonly domainLockRedirectUrl: string;
@@ -58,6 +58,7 @@ export declare class NodeGuards {
58
58
  static isNodeWithComments(node: ESTree.Node): node is ESTree.Node;
59
59
  static isObjectPatternNode(node: ESTree.Node): node is ESTree.ObjectPattern;
60
60
  static isObjectExpressionNode(node: ESTree.Node): node is ESTree.ObjectExpression;
61
+ static isPrivateIdentifierNode(node: ESTree.Node): node is ESTree.PrivateIdentifier;
61
62
  static isProgramNode(node: ESTree.Node): node is ESTree.Program;
62
63
  static isPropertyNode(node: ESTree.Node): node is ESTree.Property;
63
64
  static isPropertyDefinitionNode(node: ESTree.Node): node is ESTree.PropertyDefinition;
@@ -2,7 +2,9 @@ import * as ESTree from 'estree';
2
2
  export declare class NodeMetadata {
3
3
  static set<T extends ESTree.Node = ESTree.Node>(node: T, metadata: Partial<T['metadata']>): void;
4
4
  static get<T extends ESTree.BaseNodeMetadata, TMetadataKey extends keyof T>(node: ESTree.Node, metadataKey: TMetadataKey): T[TMetadataKey] | undefined;
5
+ static isEvalHostNode(node: ESTree.Node): boolean;
5
6
  static isForceTransformNode(node: ESTree.Node): boolean;
6
7
  static isIgnoredNode(node: ESTree.Node): boolean;
8
+ static isPropertyKeyToRenameNode(node: ESTree.Identifier | ESTree.Literal): boolean;
7
9
  static isStringArrayCallLiteralNode(literalNode: ESTree.Literal): boolean;
8
10
  }
@@ -12,9 +12,9 @@ export declare abstract class AbstractControlFlowReplacer implements IControlFlo
12
12
  protected readonly identifierNamesGenerator: IIdentifierNamesGenerator;
13
13
  protected readonly options: IOptions;
14
14
  protected readonly randomGenerator: IRandomGenerator;
15
- protected readonly replacerDataByControlFlowStorageId: Map<string, Map<string, string[]>>;
15
+ protected readonly replacerDataByControlFlowStorageId: Map<string, Map<string | number, string[]>>;
16
16
  constructor(controlFlowCustomNodeFactory: TControlFlowCustomNodeFactory, identifierNamesGeneratorFactory: TIdentifierNamesGeneratorFactory, randomGenerator: IRandomGenerator, options: IOptions);
17
17
  generateStorageKey(controlFlowStorage: IControlFlowStorage): string;
18
- protected insertCustomNodeToControlFlowStorage(customNode: ICustomNode, controlFlowStorage: IControlFlowStorage, replacerId: string, usingExistingIdentifierChance: number): string;
18
+ protected insertCustomNodeToControlFlowStorage(customNode: ICustomNode, controlFlowStorage: IControlFlowStorage, replacerId: string | number, usingExistingIdentifierChance: number): string;
19
19
  abstract replace(node: ESTree.Node, parentNode: ESTree.Node, controlFlowStorage: IControlFlowStorage): ESTree.Node;
20
20
  }
@@ -7,13 +7,12 @@ import { NodeTransformationStage } from '../../enums/node-transformers/NodeTrans
7
7
  import { AbstractNodeTransformer } from '../AbstractNodeTransformer';
8
8
  export declare class EvalCallExpressionTransformer extends AbstractNodeTransformer {
9
9
  readonly runAfter: NodeTransformer[];
10
- private readonly evalRootAstHostNodeSet;
11
10
  constructor(randomGenerator: IRandomGenerator, options: IOptions);
12
11
  private static extractEvalStringFromCallExpressionArgument;
13
12
  private static extractEvalStringFromLiteralNode;
14
13
  private static extractEvalStringFromTemplateLiteralNode;
15
14
  getVisitor(nodeTransformationStage: NodeTransformationStage): IVisitor | null;
16
- transformNode(callExpressionNode: ESTree.CallExpression, parentNode: ESTree.Node): ESTree.Node;
17
- restoreNode(evalRootAstHostNode: ESTree.FunctionExpression, parentNode: ESTree.Node): ESTree.Node;
15
+ transformNode(node: ESTree.Node, parentNode: ESTree.Node): ESTree.Node;
16
+ restoreNode(node: ESTree.Node, parentNode: ESTree.Node): ESTree.Node;
18
17
  private isEvalRootAstHostNode;
19
18
  }
@@ -12,9 +12,5 @@ export declare class RenamePropertiesTransformer extends AbstractNodeTransformer
12
12
  getVisitor(nodeTransformationStage: NodeTransformationStage): IVisitor | null;
13
13
  prepareNode(node: ESTree.Node, parentNode: ESTree.Node): void;
14
14
  transformNode(node: ESTree.Node, parentNode: ESTree.Node): ESTree.Node;
15
- private transformPropertyNode;
16
- private transformPropertyDefinitionNode;
17
- private transformMemberExpressionNode;
18
- private transformMethodDefinitionNode;
19
15
  private analyzeAutoExcludedPropertyNames;
20
16
  }
@@ -21,7 +21,7 @@ export declare class Options implements IOptions {
21
21
  readonly deadCodeInjection: boolean;
22
22
  readonly deadCodeInjectionThreshold: number;
23
23
  readonly debugProtection: boolean;
24
- readonly debugProtectionInterval: boolean;
24
+ readonly debugProtectionInterval: number;
25
25
  readonly disableConsoleOutput: boolean;
26
26
  readonly domainLock: string[];
27
27
  readonly domainLockRedirectUrl: string;