javascript-obfuscator 3.2.2 → 3.2.6
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/CHANGELOG.md +17 -0
- package/dist/index.browser.js +1 -1
- package/dist/index.browser.js.map +1 -1
- package/dist/index.cli.js +1 -1
- package/dist/index.cli.js.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
- package/typings/src/constants/ReservedIdentifierNames.d.ts +1 -0
- package/typings/src/enums/node/NodeType.d.ts +1 -0
- package/typings/src/generators/identifier-names-generators/AbstractIdentifierNamesGenerator.d.ts +1 -1
- package/typings/src/generators/identifier-names-generators/MangledIdentifierNamesGenerator.d.ts +2 -2
- package/typings/src/node/NodeGuards.d.ts +1 -0
- package/typings/src/node/NodeMetadata.d.ts +1 -0
- package/typings/src/node-transformers/control-flow-transformers/StringArrayControlFlowTransformer.d.ts +2 -1
- package/typings/src/node-transformers/control-flow-transformers/control-flow-replacers/AbstractControlFlowReplacer.d.ts +2 -2
- package/typings/src/node-transformers/rename-properties-transformers/RenamePropertiesTransformer.d.ts +0 -4
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "javascript-obfuscator",
|
|
3
|
-
"version": "3.2.
|
|
3
|
+
"version": "3.2.6",
|
|
4
4
|
"description": "JavaScript obfuscator",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"obfuscator",
|
|
@@ -23,7 +23,6 @@
|
|
|
23
23
|
"dependencies": {
|
|
24
24
|
"@javascript-obfuscator/escodegen": "2.3.0",
|
|
25
25
|
"@javascript-obfuscator/estraverse": "5.4.0",
|
|
26
|
-
"@nuxtjs/opencollective": "0.3.2",
|
|
27
26
|
"acorn": "8.7.0",
|
|
28
27
|
"assert": "2.0.0",
|
|
29
28
|
"chalk": "4.1.2",
|
|
@@ -38,6 +37,7 @@
|
|
|
38
37
|
"md5": "2.3.0",
|
|
39
38
|
"mkdirp": "1.0.4",
|
|
40
39
|
"multimatch": "5.0.0",
|
|
40
|
+
"opencollective-postinstall": "2.0.3",
|
|
41
41
|
"process": "0.11.10",
|
|
42
42
|
"reflect-metadata": "0.1.13",
|
|
43
43
|
"source-map-support": "0.5.21",
|
|
@@ -118,7 +118,7 @@
|
|
|
118
118
|
"test": "yarn run test:full",
|
|
119
119
|
"eslint": "eslint src/**/*.ts",
|
|
120
120
|
"git:addFiles": "git add .",
|
|
121
|
-
"postinstall": "opencollective",
|
|
121
|
+
"postinstall": "opencollective-postinstall",
|
|
122
122
|
"precommit": "npm run build",
|
|
123
123
|
"prepublishOnly": "npm run build && npm run build:typings",
|
|
124
124
|
"prepare": "husky install"
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const reservedIdentifierNames: string[];
|
|
@@ -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",
|
package/typings/src/generators/identifier-names-generators/AbstractIdentifierNamesGenerator.d.ts
CHANGED
|
@@ -13,7 +13,7 @@ export declare abstract class AbstractIdentifierNamesGenerator implements IIdent
|
|
|
13
13
|
preserveNameForLexicalScope(name: string, lexicalScopeNode: TNodeWithLexicalScope): void;
|
|
14
14
|
isValidIdentifierName(name: string): boolean;
|
|
15
15
|
isValidIdentifierNameInLexicalScopes(name: string, lexicalScopeNodes: TNodeWithLexicalScope[]): boolean;
|
|
16
|
-
private
|
|
16
|
+
private isReservedName;
|
|
17
17
|
abstract generateForGlobalScope(nameLength?: number): string;
|
|
18
18
|
abstract generateForLexicalScope(lexicalScopeNode: TNodeWithLexicalScope, nameLength?: number): string;
|
|
19
19
|
abstract generateForLabel(label: string, nameLength?: number): string;
|
package/typings/src/generators/identifier-names-generators/MangledIdentifierNamesGenerator.d.ts
CHANGED
|
@@ -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;
|
|
@@ -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;
|
|
@@ -4,5 +4,6 @@ export declare class NodeMetadata {
|
|
|
4
4
|
static get<T extends ESTree.BaseNodeMetadata, TMetadataKey extends keyof T>(node: ESTree.Node, metadataKey: TMetadataKey): T[TMetadataKey] | undefined;
|
|
5
5
|
static isForceTransformNode(node: ESTree.Node): boolean;
|
|
6
6
|
static isIgnoredNode(node: ESTree.Node): boolean;
|
|
7
|
+
static isPropertyKeyToRenameNode(node: ESTree.Identifier | ESTree.Literal): boolean;
|
|
7
8
|
static isStringArrayCallLiteralNode(literalNode: ESTree.Literal): boolean;
|
|
8
9
|
}
|
|
@@ -5,6 +5,7 @@ import { TControlFlowCustomNodeFactory } from '../../types/container/custom-node
|
|
|
5
5
|
import { TControlFlowReplacerFactory } from '../../types/container/node-transformers/TControlFlowReplacerFactory';
|
|
6
6
|
import { TControlFlowStorageFactoryCreator } from '../../types/container/node-transformers/TControlFlowStorageFactoryCreator';
|
|
7
7
|
import { TNodeWithStatements } from '../../types/node/TNodeWithStatements';
|
|
8
|
+
import { IControlFlowStorage } from '../../interfaces/storages/control-flow-transformers/IControlFlowStorage';
|
|
8
9
|
import { IOptions } from '../../interfaces/options/IOptions';
|
|
9
10
|
import { IRandomGenerator } from '../../interfaces/utils/IRandomGenerator';
|
|
10
11
|
import { IVisitor } from '../../interfaces/node-transformers/IVisitor';
|
|
@@ -12,7 +13,6 @@ import { ControlFlowReplacer } from '../../enums/node-transformers/control-flow-
|
|
|
12
13
|
import { NodeTransformationStage } from '../../enums/node-transformers/NodeTransformationStage';
|
|
13
14
|
import { NodeTransformer } from '../../enums/node-transformers/NodeTransformer';
|
|
14
15
|
import { FunctionControlFlowTransformer } from './FunctionControlFlowTransformer';
|
|
15
|
-
import { IControlFlowStorage } from '../../interfaces/storages/control-flow-transformers/IControlFlowStorage';
|
|
16
16
|
export declare class StringArrayControlFlowTransformer extends FunctionControlFlowTransformer {
|
|
17
17
|
readonly runAfter: NodeTransformer[];
|
|
18
18
|
protected readonly controlFlowReplacersMap: Map<string, ControlFlowReplacer>;
|
|
@@ -20,6 +20,7 @@ export declare class StringArrayControlFlowTransformer extends FunctionControlFl
|
|
|
20
20
|
constructor(controlFlowStorageFactoryCreator: TControlFlowStorageFactoryCreator, controlFlowReplacerFactory: TControlFlowReplacerFactory, controlFlowCustomNodeFactory: TControlFlowCustomNodeFactory, randomGenerator: IRandomGenerator, options: IOptions);
|
|
21
21
|
getVisitor(nodeTransformationStage: NodeTransformationStage): IVisitor | null;
|
|
22
22
|
protected transformFunctionBodyNode(node: ESTree.Node, parentNode: ESTree.Node | null, functionNode: ESTree.Function, controlFlowStorage: IControlFlowStorage): estraverse.VisitorOption | ESTree.Node;
|
|
23
|
+
protected getControlFlowStorage(hostNode: TNodeWithStatements): IControlFlowStorage;
|
|
23
24
|
protected appendControlFlowStorageNode(hostNode: TNodeWithStatements, controlFlowStorageNode: ESTree.VariableDeclaration): void;
|
|
24
25
|
protected isAllowedTransformationByThreshold(): boolean;
|
|
25
26
|
}
|
|
@@ -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
|
}
|
|
@@ -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
|
}
|