javascript-obfuscator 4.1.1 → 4.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/.eslintrc.js +245 -289
- package/.prettierignore +34 -0
- package/.prettierrc.js +50 -0
- package/CHANGELOG.md +17 -0
- package/CLAUDE.md +1478 -0
- package/dist/index.browser.js +1 -1
- package/dist/index.browser.js.LICENSE.txt +0 -7
- 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/dist/index_debug.js +14907 -0
- package/dist/index_debug.js.LICENSE.txt +23 -0
- package/dist/index_debug.js.map +1 -0
- package/package.json +59 -53
- package/typings/src/cli/JavaScriptObfuscatorCLI.d.ts +0 -1
- package/typings/src/constants/EcmaVersion.d.ts +2 -1
- package/typings/src/custom-nodes/control-flow-flattening-nodes/CallExpressionFunctionNode.d.ts +2 -1
- package/typings/src/enums/node/NodeType.d.ts +1 -0
- package/typings/src/enums/node-transformers/preparing-transformers/obfuscating-guards/ObfuscatingGuard.d.ts +1 -0
- package/typings/src/interfaces/node-transformers/INodeTransformer.d.ts +0 -1
- package/typings/src/interfaces/node-transformers/IVisitor.d.ts +0 -1
- package/typings/src/interfaces/utils/IRandomGenerator.d.ts +0 -1
- package/typings/src/node/NodeFactory.d.ts +1 -0
- package/typings/src/node/NodeGuards.d.ts +2 -0
- package/typings/src/node-transformers/AbstractNodeTransformer.d.ts +0 -1
- package/typings/src/node-transformers/control-flow-transformers/FunctionControlFlowTransformer.d.ts +0 -1
- package/typings/src/node-transformers/control-flow-transformers/StringArrayControlFlowTransformer.d.ts +0 -1
- package/typings/src/node-transformers/dead-code-injection-transformers/DeadCodeInjectionTransformer.d.ts +0 -1
- package/typings/src/node-transformers/preparing-transformers/obfuscating-guards/ImportMetaObfuscationGuard.d.ts +6 -0
- package/typings/src/node-transformers/simplifying-transformers/ExpressionStatementsMergeTransformer.d.ts +0 -1
- package/typings/src/node-transformers/simplifying-transformers/VariableDeclarationsMergeTransformer.d.ts +0 -1
- package/typings/src/types/node/TNodeWithSingleStatementBody.d.ts +2 -2
- package/typings/src/types/node-transformers/TVisitorResult.d.ts +0 -1
- package/typings/src/types/utils/TTypeFromEnum.d.ts +1 -1
- package/typings/src/utils/RandomGenerator.d.ts +0 -1
- package/index.cli.ts +0 -5
- package/index.ts +0 -44
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "javascript-obfuscator",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.2.1",
|
|
4
4
|
"description": "JavaScript obfuscator",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"obfuscator",
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
"js obfuscator"
|
|
13
13
|
],
|
|
14
14
|
"engines": {
|
|
15
|
-
"node": ">=
|
|
15
|
+
"node": ">=18.0.0"
|
|
16
16
|
},
|
|
17
17
|
"main": "dist/index.js",
|
|
18
18
|
"browser": "dist/index.browser.js",
|
|
@@ -21,79 +21,82 @@
|
|
|
21
21
|
},
|
|
22
22
|
"types": "typings/index.d.ts",
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@javascript-obfuscator/escodegen": "2.3.
|
|
24
|
+
"@javascript-obfuscator/escodegen": "2.3.1",
|
|
25
25
|
"@javascript-obfuscator/estraverse": "5.4.0",
|
|
26
|
-
"acorn": "8.
|
|
27
|
-
"assert": "2.
|
|
26
|
+
"acorn": "8.15.0",
|
|
27
|
+
"assert": "2.1.0",
|
|
28
28
|
"chalk": "4.1.2",
|
|
29
|
-
"chance": "1.1.
|
|
30
|
-
"class-validator": "0.14.
|
|
31
|
-
"commander": "
|
|
32
|
-
"eslint-scope": "
|
|
33
|
-
"eslint-visitor-keys": "
|
|
29
|
+
"chance": "1.1.13",
|
|
30
|
+
"class-validator": "0.14.3",
|
|
31
|
+
"commander": "12.1.0",
|
|
32
|
+
"eslint-scope": "8.4.0",
|
|
33
|
+
"eslint-visitor-keys": "4.2.1",
|
|
34
34
|
"fast-deep-equal": "3.1.3",
|
|
35
|
-
"inversify": "6.
|
|
35
|
+
"inversify": "6.1.4",
|
|
36
36
|
"js-string-escape": "1.0.1",
|
|
37
37
|
"md5": "2.3.0",
|
|
38
|
-
"mkdirp": "
|
|
38
|
+
"mkdirp": "3.0.1",
|
|
39
39
|
"multimatch": "5.0.0",
|
|
40
40
|
"opencollective-postinstall": "2.0.3",
|
|
41
41
|
"process": "0.11.10",
|
|
42
|
-
"reflect-metadata": "0.
|
|
42
|
+
"reflect-metadata": "0.2.2",
|
|
43
43
|
"source-map-support": "0.5.21",
|
|
44
44
|
"string-template": "1.0.0",
|
|
45
45
|
"stringz": "2.1.0",
|
|
46
|
-
"tslib": "2.
|
|
46
|
+
"tslib": "2.8.1"
|
|
47
47
|
},
|
|
48
48
|
"devDependencies": {
|
|
49
49
|
"@istanbuljs/nyc-config-typescript": "1.0.2",
|
|
50
|
-
"@types/chai": "4.3.
|
|
51
|
-
"@types/chance": "1.1.
|
|
52
|
-
"@types/escodegen": "0.0.
|
|
53
|
-
"@types/eslint-scope": "3.7.
|
|
50
|
+
"@types/chai": "4.3.20",
|
|
51
|
+
"@types/chance": "1.1.7",
|
|
52
|
+
"@types/escodegen": "0.0.10",
|
|
53
|
+
"@types/eslint-scope": "3.7.7",
|
|
54
54
|
"@types/eslint-visitor-keys": "1.0.0",
|
|
55
|
-
"@types/estraverse": "5.1.
|
|
55
|
+
"@types/estraverse": "5.1.7",
|
|
56
56
|
"@types/estree": "0.0.51",
|
|
57
|
-
"@types/js-beautify": "1.
|
|
58
|
-
"@types/js-string-escape": "1.0.
|
|
59
|
-
"@types/md5": "2.3.
|
|
57
|
+
"@types/js-beautify": "1.14.3",
|
|
58
|
+
"@types/js-string-escape": "1.0.3",
|
|
59
|
+
"@types/md5": "2.3.6",
|
|
60
60
|
"@types/mkdirp": "1.0.2",
|
|
61
|
-
"@types/mocha": "10.0.
|
|
61
|
+
"@types/mocha": "10.0.10",
|
|
62
62
|
"@types/multimatch": "4.0.0",
|
|
63
|
-
"@types/node": "
|
|
63
|
+
"@types/node": "22.10.2",
|
|
64
64
|
"@types/rimraf": "3.0.2",
|
|
65
|
-
"@types/sinon": "
|
|
66
|
-
"@types/string-template": "1.0.
|
|
67
|
-
"@types/webpack-env": "1.18.
|
|
68
|
-
"@typescript-eslint/eslint-plugin": "
|
|
69
|
-
"@typescript-eslint/parser": "
|
|
70
|
-
"chai": "4.
|
|
71
|
-
"chai-exclude": "
|
|
72
|
-
"cross-env": "
|
|
73
|
-
"eslint": "8.
|
|
74
|
-
"eslint-
|
|
75
|
-
"eslint-plugin-
|
|
65
|
+
"@types/sinon": "17.0.4",
|
|
66
|
+
"@types/string-template": "1.0.7",
|
|
67
|
+
"@types/webpack-env": "1.18.8",
|
|
68
|
+
"@typescript-eslint/eslint-plugin": "7.18.0",
|
|
69
|
+
"@typescript-eslint/parser": "7.18.0",
|
|
70
|
+
"chai": "4.5.0",
|
|
71
|
+
"chai-exclude": "3.0.1",
|
|
72
|
+
"cross-env": "10.1.0",
|
|
73
|
+
"eslint": "8.57.1",
|
|
74
|
+
"eslint-config-prettier": "10.1.8",
|
|
75
|
+
"eslint-plugin-import": "2.32.0",
|
|
76
|
+
"eslint-plugin-jsdoc": "50.6.3",
|
|
76
77
|
"eslint-plugin-no-null": "1.0.2",
|
|
77
78
|
"eslint-plugin-prefer-arrow": "1.2.3",
|
|
78
|
-
"eslint-plugin-
|
|
79
|
-
"eslint-
|
|
80
|
-
"
|
|
81
|
-
"fork-ts-checker-webpack-plugin": "
|
|
82
|
-
"
|
|
83
|
-
"
|
|
84
|
-
"
|
|
85
|
-
"
|
|
79
|
+
"eslint-plugin-prettier": "5.5.4",
|
|
80
|
+
"eslint-plugin-unicorn": "56.0.1",
|
|
81
|
+
"eslint-webpack-plugin": "4.2.0",
|
|
82
|
+
"fork-ts-checker-notifier-webpack-plugin": "9.0.0",
|
|
83
|
+
"fork-ts-checker-webpack-plugin": "9.1.0",
|
|
84
|
+
"husky": "9.1.7",
|
|
85
|
+
"js-beautify": "1.15.4",
|
|
86
|
+
"mocha": "11.7.4",
|
|
87
|
+
"nyc": "17.1.0",
|
|
86
88
|
"pjson": "1.0.9",
|
|
87
|
-
"
|
|
88
|
-
"
|
|
89
|
+
"prettier": "3.6.2",
|
|
90
|
+
"rimraf": "6.0.1",
|
|
91
|
+
"sinon": "19.0.2",
|
|
89
92
|
"source-map-resolve": "0.6.0",
|
|
90
|
-
"terser": "5.
|
|
93
|
+
"terser": "5.44.0",
|
|
91
94
|
"threads": "1.7.0",
|
|
92
|
-
"ts-loader": "9.4
|
|
93
|
-
"ts-node": "10.9.
|
|
94
|
-
"typescript": "
|
|
95
|
-
"webpack": "5.
|
|
96
|
-
"webpack-cli": "
|
|
95
|
+
"ts-loader": "9.5.4",
|
|
96
|
+
"ts-node": "10.9.2",
|
|
97
|
+
"typescript": "5.9.3",
|
|
98
|
+
"webpack": "5.102.1",
|
|
99
|
+
"webpack-cli": "6.0.1",
|
|
97
100
|
"webpack-node-externals": "3.0.0"
|
|
98
101
|
},
|
|
99
102
|
"repository": {
|
|
@@ -117,10 +120,13 @@
|
|
|
117
120
|
"test:mocha-memory-performance": "cross-env NODE_OPTIONS=--max-old-space-size=280 mocha --require ts-node/register test/performance-tests/JavaScriptObfuscatorMemory.spec.ts",
|
|
118
121
|
"test": "yarn run test:full",
|
|
119
122
|
"eslint": "eslint src/**/*.ts",
|
|
123
|
+
"prettier": "prettier --write \"src/**/*.ts\" \"test/**/*.ts\"",
|
|
124
|
+
"prettier:check": "prettier --check \"src/**/*.ts\" \"test/**/*.ts\"",
|
|
125
|
+
"format": "yarn run prettier && yarn run eslint --fix",
|
|
120
126
|
"git:addFiles": "git add .",
|
|
121
127
|
"postinstall": "opencollective-postinstall",
|
|
122
|
-
"precommit": "
|
|
123
|
-
"prepublishOnly": "
|
|
128
|
+
"precommit": "yarn run eslint",
|
|
129
|
+
"prepublishOnly": "yarn run build && yarn run build:typings",
|
|
124
130
|
"prepare": "husky install"
|
|
125
131
|
},
|
|
126
132
|
"author": {
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
import * as acorn from 'acorn';
|
|
2
|
+
export declare const ecmaVersion: acorn.Options["ecmaVersion"] & number;
|
package/typings/src/custom-nodes/control-flow-flattening-nodes/CallExpressionFunctionNode.d.ts
CHANGED
|
@@ -7,7 +7,8 @@ import { IRandomGenerator } from '../../interfaces/utils/IRandomGenerator';
|
|
|
7
7
|
import { AbstractCustomNode } from '../AbstractCustomNode';
|
|
8
8
|
export declare class CallExpressionFunctionNode extends AbstractCustomNode {
|
|
9
9
|
private expressionArguments;
|
|
10
|
+
private isChainExpressionParent;
|
|
10
11
|
constructor(identifierNamesGeneratorFactory: TIdentifierNamesGeneratorFactory, customCodeHelperFormatter: ICustomCodeHelperFormatter, randomGenerator: IRandomGenerator, options: IOptions);
|
|
11
|
-
initialize(expressionArguments: (ESTree.Expression | ESTree.SpreadElement)[]): void;
|
|
12
|
+
initialize(expressionArguments: (ESTree.Expression | ESTree.SpreadElement)[], isChainExpressionParent: boolean): void;
|
|
12
13
|
protected getNodeStructure(): TStatement[];
|
|
13
14
|
}
|
|
@@ -36,6 +36,7 @@ export declare enum NodeType {
|
|
|
36
36
|
Literal = "Literal",
|
|
37
37
|
LogicalExpression = "LogicalExpression",
|
|
38
38
|
MemberExpression = "MemberExpression",
|
|
39
|
+
MetaProperty = "MetaProperty",
|
|
39
40
|
MethodDefinition = "MethodDefinition",
|
|
40
41
|
NewExpression = "NewExpression",
|
|
41
42
|
ObjectExpression = "ObjectExpression",
|
|
@@ -3,5 +3,6 @@ export declare enum ObfuscatingGuard {
|
|
|
3
3
|
ConditionalCommentObfuscatingGuard = "ConditionalCommentObfuscatingGuard",
|
|
4
4
|
ForceTransformStringObfuscatingGuard = "ForceTransformStringObfuscatingGuard",
|
|
5
5
|
IgnoredImportObfuscatingGuard = "IgnoredImportObfuscatingGuard",
|
|
6
|
+
ImportMetaObfuscationGuard = "ImportMetaObfuscationGuard",
|
|
6
7
|
ReservedStringObfuscatingGuard = "ReservedStringObfuscatingGuard"
|
|
7
8
|
}
|
|
@@ -8,6 +8,7 @@ export declare class NodeFactory {
|
|
|
8
8
|
static blockStatementNode(body?: ESTree.Statement[]): ESTree.BlockStatement;
|
|
9
9
|
static breakStatement(label?: ESTree.Identifier): ESTree.BreakStatement;
|
|
10
10
|
static callExpressionNode(callee: ESTree.Expression, args?: (ESTree.Expression | ESTree.SpreadElement)[], optional?: boolean): ESTree.CallExpression;
|
|
11
|
+
static chainExpressionNode(expression: ESTree.ChainElement): ESTree.ChainExpression;
|
|
11
12
|
static conditionalExpressionNode(test: ESTree.Expression, consequent: ESTree.Expression, alternate: ESTree.Expression): ESTree.ConditionalExpression;
|
|
12
13
|
static continueStatement(label?: ESTree.Identifier): ESTree.ContinueStatement;
|
|
13
14
|
static directiveNode(expression: ESTree.Literal, directive: string): ESTree.Directive;
|
|
@@ -14,6 +14,7 @@ export declare class NodeGuards {
|
|
|
14
14
|
static isBlockStatementNode(node: ESTree.Node): node is ESTree.BlockStatement;
|
|
15
15
|
static isBreakStatementNode(node: ESTree.Node): node is ESTree.BreakStatement;
|
|
16
16
|
static isCallExpressionNode(node: ESTree.Node): node is ESTree.CallExpression;
|
|
17
|
+
static isChainExpressionNode(node: ESTree.Node): node is ESTree.ChainExpression;
|
|
17
18
|
static isClassBodyNode(node: ESTree.Node): node is ESTree.ClassBody;
|
|
18
19
|
static isClassDeclarationNode(node: ESTree.Node): node is ESTree.ClassDeclaration & {
|
|
19
20
|
id: ESTree.Identifier;
|
|
@@ -45,6 +46,7 @@ export declare class NodeGuards {
|
|
|
45
46
|
static isLiteralNode(node: ESTree.Node): node is ESTree.Literal;
|
|
46
47
|
static isLogicalExpressionNode(node: ESTree.Node): node is ESTree.LogicalExpression;
|
|
47
48
|
static isMemberExpressionNode(node: ESTree.Node): node is ESTree.MemberExpression;
|
|
49
|
+
static isMetaPropertyNode(node: ESTree.Node): node is ESTree.MetaProperty;
|
|
48
50
|
static isMethodDefinitionNode(node: ESTree.Node): node is ESTree.MethodDefinition;
|
|
49
51
|
static isNewExpressionNode(node: ESTree.Node): node is ESTree.NewExpression;
|
|
50
52
|
static isNode(object: Object & {
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import * as ESTree from 'estree';
|
|
2
|
+
import { IObfuscatingGuard } from '../../../interfaces/node-transformers/preparing-transformers/obfuscating-guards/IObfuscatingGuard';
|
|
3
|
+
import { ObfuscatingGuardResult } from '../../../enums/node/ObfuscatingGuardResult';
|
|
4
|
+
export declare class ImportMetaObfuscationGuard implements IObfuscatingGuard {
|
|
5
|
+
check(node: ESTree.Node): ObfuscatingGuardResult;
|
|
6
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as ESTree from 'estree';
|
|
2
|
-
export type TNodeWithSingleStatementBody = (ESTree.LabeledStatement | ESTree.WithStatement | ESTree.WhileStatement | ESTree.DoWhileStatement | ESTree.ForStatement | ESTree.ForInStatement | ESTree.ForOfStatement & {
|
|
2
|
+
export type TNodeWithSingleStatementBody = (ESTree.LabeledStatement | ESTree.WithStatement | ESTree.WhileStatement | ESTree.DoWhileStatement | ESTree.ForStatement | ESTree.ForInStatement | (ESTree.ForOfStatement & {
|
|
3
3
|
body: Exclude<ESTree.Statement, ESTree.BlockStatement>;
|
|
4
|
-
}) | (ESTree.IfStatement & {
|
|
4
|
+
})) | (ESTree.IfStatement & {
|
|
5
5
|
consequent: Exclude<ESTree.Statement, ESTree.BlockStatement>;
|
|
6
6
|
alternate?: Exclude<ESTree.Statement, ESTree.BlockStatement> | null;
|
|
7
7
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export type TTypeFromEnum<T extends object> =
|
|
1
|
+
export type TTypeFromEnum<T extends object> = T[keyof T];
|
package/index.cli.ts
DELETED
package/index.ts
DELETED
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
import { TDictionary } from './src/types/TDictionary';
|
|
4
|
-
import { TInputOptions } from './src/types/options/TInputOptions';
|
|
5
|
-
import { TObfuscationResultsObject } from './src/types/TObfuscationResultsObject';
|
|
6
|
-
import { TOptionsPreset } from './src/types/options/TOptionsPreset';
|
|
7
|
-
|
|
8
|
-
import { IObfuscationResult } from './src/interfaces/source-code/IObfuscationResult';
|
|
9
|
-
|
|
10
|
-
import { JavaScriptObfuscator } from './src/JavaScriptObfuscatorFacade';
|
|
11
|
-
|
|
12
|
-
export type ObfuscatorOptions = TInputOptions;
|
|
13
|
-
|
|
14
|
-
export interface ObfuscationResult extends IObfuscationResult {}
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* @param {string} sourceCode
|
|
18
|
-
* @param {ObfuscatorOptions} inputOptions
|
|
19
|
-
* @returns {ObfuscatedCode}
|
|
20
|
-
*/
|
|
21
|
-
export declare function obfuscate (sourceCode: string, inputOptions?: ObfuscatorOptions): ObfuscationResult;
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
* @param {TSourceCodesObject} sourceCodesObject
|
|
25
|
-
* @param {TInputOptions} inputOptions
|
|
26
|
-
* @returns {TObfuscationResultsObject<TSourceCodesObject>}
|
|
27
|
-
*/
|
|
28
|
-
export declare function obfuscateMultiple <TSourceCodesObject extends TDictionary<string>> (
|
|
29
|
-
sourceCodesObject: TSourceCodesObject,
|
|
30
|
-
inputOptions?: TInputOptions
|
|
31
|
-
): TObfuscationResultsObject<TSourceCodesObject>;
|
|
32
|
-
|
|
33
|
-
/**
|
|
34
|
-
* @param {TOptionsPreset} optionsPreset
|
|
35
|
-
* @returns {TInputOptions}
|
|
36
|
-
*/
|
|
37
|
-
export declare function getOptionsByPreset (optionsPreset: TOptionsPreset): TInputOptions;
|
|
38
|
-
|
|
39
|
-
/**
|
|
40
|
-
* @type {string}
|
|
41
|
-
*/
|
|
42
|
-
export declare const version: string;
|
|
43
|
-
|
|
44
|
-
module.exports = JavaScriptObfuscator;
|