javascript-obfuscator 5.3.0 → 5.4.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": "5.3.0",
3
+ "version": "5.4.0",
4
4
  "description": "JavaScript obfuscator",
5
5
  "keywords": [
6
6
  "obfuscator",
@@ -21,23 +21,23 @@
21
21
  },
22
22
  "types": "typings/index.d.ts",
23
23
  "dependencies": {
24
- "@javascript-obfuscator/escodegen": "2.3.1",
24
+ "@javascript-obfuscator/escodegen": "2.4.0",
25
25
  "@javascript-obfuscator/estraverse": "5.4.0",
26
26
  "@vercel/blob": ">=0.23.0",
27
27
  "acorn": "8.15.0",
28
+ "acorn-import-attributes": "^1.9.5",
28
29
  "assert": "2.1.0",
29
30
  "chalk": "4.1.2",
30
31
  "chance": "1.1.13",
31
32
  "class-validator": "0.14.3",
32
33
  "commander": "12.1.0",
33
- "conf": "15.0.2",
34
+ "env-paths": "4.0.0",
34
35
  "eslint-scope": "8.4.0",
35
36
  "eslint-visitor-keys": "4.2.1",
36
37
  "fast-deep-equal": "3.1.3",
37
38
  "inversify": "6.1.4",
38
39
  "js-string-escape": "1.0.1",
39
40
  "md5": "2.3.0",
40
- "mkdirp": "3.0.1",
41
41
  "multimatch": "5.0.0",
42
42
  "process": "0.11.10",
43
43
  "reflect-metadata": "0.2.2",
@@ -58,7 +58,6 @@
58
58
  "@types/js-beautify": "1.14.3",
59
59
  "@types/js-string-escape": "1.0.3",
60
60
  "@types/md5": "2.3.6",
61
- "@types/mkdirp": "1.0.2",
62
61
  "@types/mocha": "10.0.10",
63
62
  "@types/multimatch": "4.0.0",
64
63
  "@types/node": "22.10.2",
@@ -3,6 +3,7 @@ import { IIdentifierNamesGenerator } from '../../interfaces/generators/identifie
3
3
  import { IOptions } from '../../interfaces/options/IOptions';
4
4
  import { IRandomGenerator } from '../../interfaces/utils/IRandomGenerator';
5
5
  export declare abstract class AbstractIdentifierNamesGenerator implements IIdentifierNamesGenerator {
6
+ private static readonly maxGenerationAttempts;
6
7
  protected readonly options: IOptions;
7
8
  protected readonly randomGenerator: IRandomGenerator;
8
9
  protected readonly preservedNamesSet: Set<string>;
@@ -15,6 +16,7 @@ export declare abstract class AbstractIdentifierNamesGenerator implements IIdent
15
16
  isValidIdentifierName(name: string): boolean;
16
17
  isValidIdentifierNameInLexicalScopes(name: string, lexicalScopeNodes: TNodeWithLexicalScope[]): boolean;
17
18
  isValidIdentifierNameInAllScopes(name: string): boolean;
19
+ protected checkGenerationAttempts(attempts: number): void;
18
20
  private isReservedName;
19
21
  abstract generateForGlobalScope(nameLength?: number): string;
20
22
  abstract generateForGlobalScopeWithAllScopesValidation(nameLength?: number): string;
@@ -1,5 +1,5 @@
1
1
  import * as ESTree from 'estree';
2
2
  export interface IRenamePropertiesReplacer {
3
3
  excludePropertyName(propertyName: string): void;
4
- replace(node: ESTree.Identifier | ESTree.Literal): ESTree.Identifier | ESTree.Literal;
4
+ replace(node: ESTree.Identifier | ESTree.Literal | ESTree.PrivateIdentifier): ESTree.Identifier | ESTree.Literal | ESTree.PrivateIdentifier;
5
5
  }
@@ -23,6 +23,7 @@ export declare class NodeFactory {
23
23
  static functionExpressionNode(params: ESTree.Pattern[], body: ESTree.BlockStatement): ESTree.FunctionExpression;
24
24
  static ifStatementNode(test: ESTree.Expression, consequent: ESTree.Statement, alternate?: ESTree.Statement | null): ESTree.IfStatement;
25
25
  static identifierNode(name: string): ESTree.Identifier;
26
+ static privateIdentifierNode(name: string): ESTree.PrivateIdentifier;
26
27
  static importDeclarationNode(specifiers: (ESTree.ImportSpecifier | ESTree.ImportDefaultSpecifier | ESTree.ImportNamespaceSpecifier)[], source: ESTree.Literal): ESTree.ImportDeclaration;
27
28
  static labeledStatementNode(label: ESTree.Identifier, body: ESTree.Statement): ESTree.LabeledStatement;
28
29
  static literalNode(value: boolean | number | string, raw?: string): ESTree.Literal;
@@ -5,6 +5,6 @@ export declare class NodeMetadata {
5
5
  static isEvalHostNode(node: ESTree.Node): boolean;
6
6
  static isForceTransformNode(node: ESTree.Node): boolean;
7
7
  static isIgnoredNode(node: ESTree.Node): boolean;
8
- static isPropertyKeyToRenameNode(node: ESTree.Identifier | ESTree.Literal): boolean;
8
+ static isPropertyKeyToRenameNode(node: ESTree.Identifier | ESTree.PrivateIdentifier | ESTree.Literal): boolean;
9
9
  static isStringArrayCallLiteralNode(literalNode: ESTree.Literal): boolean;
10
10
  }
@@ -9,6 +9,7 @@ export declare class ClassFieldTransformer extends AbstractNodeTransformer {
9
9
  constructor(randomGenerator: IRandomGenerator, options: IOptions);
10
10
  getVisitor(nodeTransformationStage: NodeTransformationStage): IVisitor | null;
11
11
  transformNode(classFieldNode: ESTree.MethodDefinition | ESTree.PropertyDefinition, parentNode: ESTree.Node): ESTree.Node;
12
+ private isIgnoredName;
12
13
  private replaceIdentifierKey;
13
14
  private replaceLiteralKey;
14
15
  }
@@ -8,4 +8,5 @@ export declare class ObjectPatternPropertiesTransformer extends AbstractNodeTran
8
8
  constructor(randomGenerator: IRandomGenerator, options: IOptions);
9
9
  getVisitor(nodeTransformationStage: NodeTransformationStage): IVisitor | null;
10
10
  transformNode(propertyNode: ESTree.Property, parentNode: ESTree.Node): ESTree.Node;
11
+ private isInsideStaticBlock;
11
12
  }
@@ -10,10 +10,10 @@ export declare class IdentifierReplacer implements IIdentifierReplacer {
10
10
  private readonly blockScopesMap;
11
11
  private readonly options;
12
12
  constructor(identifierNamesGeneratorFactory: TIdentifierNamesGeneratorFactory, identifierNamesCacheStorage: IGlobalIdentifierNamesCacheStorage, options: IOptions);
13
+ static isReservedName(name: string, reservedNames: string[]): boolean;
13
14
  storeGlobalName(identifierNode: ESTree.Identifier, lexicalScopeNode: TNodeWithLexicalScope): void;
14
15
  storeLocalName(identifierNode: ESTree.Identifier, lexicalScopeNode: TNodeWithLexicalScope): void;
15
16
  replace(identifierNode: ESTree.Identifier, lexicalScopeNode: TNodeWithLexicalScope): ESTree.Identifier;
16
17
  preserveName(identifierNode: ESTree.Identifier): void;
17
18
  preserveNameForLexicalScope(identifierNode: ESTree.Identifier, lexicalScopeNode: TNodeWithLexicalScope): void;
18
- private isReservedName;
19
19
  }
@@ -12,7 +12,7 @@ export declare class RenamePropertiesReplacer implements IRenamePropertiesReplac
12
12
  private readonly options;
13
13
  constructor(identifierNamesGeneratorFactory: TIdentifierNamesGeneratorFactory, propertyIdentifierNamesCacheStorage: IPropertyIdentifierNamesCacheStorage, options: IOptions);
14
14
  excludePropertyName(propertyName: string): void;
15
- replace(node: ESTree.Identifier | ESTree.Literal): ESTree.Identifier | ESTree.Literal;
15
+ replace(node: ESTree.Identifier | ESTree.Literal | ESTree.PrivateIdentifier): ESTree.Identifier | ESTree.Literal | ESTree.PrivateIdentifier;
16
16
  private replacePropertyName;
17
17
  private isReservedName;
18
18
  private isExcludedName;
@@ -1,17 +1,13 @@
1
1
  export declare class AdvertisementUtils {
2
2
  private static readonly maxDisplayCount;
3
- private static readonly storageKey;
4
- private static readonly timestampKey;
5
3
  private static readonly resetPeriodMs;
6
4
  private static readonly ciEnvVars;
7
- private static config;
5
+ private static readonly projectName;
6
+ private static configPath;
8
7
  static isCI(): boolean;
9
8
  static shouldShowAdvertisement(): boolean;
10
9
  private static isNodeEnvironment;
11
- private static getConfig;
12
- private static getDisplayCount;
13
- private static setDisplayCount;
14
- private static getFirstDisplayTime;
15
- private static setFirstDisplayTime;
16
- private static resetDisplayData;
10
+ private static getConfigPath;
11
+ private static readConfig;
12
+ private static writeConfig;
17
13
  }
@@ -1,6 +1,7 @@
1
1
  export declare class Utils {
2
2
  static readonly baseMultipleSourcesIdentifiersPrefix: string;
3
3
  static readonly hexadecimalPrefix: string;
4
+ static readonly nodeRequire: NodeRequire;
4
5
  static buildVersionMessage(version?: string, buildTimestamp?: string): string;
5
6
  static extractDomainFrom(url: string): string;
6
7
  static getIdentifiersPrefixForMultipleSources(identifiersPrefix: string | undefined, sourceCodeIndex: number): string;