mirror of
https://github.com/javascript-obfuscator/javascript-obfuscator
synced 2026-08-09 12:42:29 +00:00
Removed few any
This commit is contained in:
Vendored
+1
-14244
File diff suppressed because one or more lines are too long
+1
-1
@@ -74,7 +74,7 @@
|
||||
"tslint-eslint-rules": "5.1.0",
|
||||
"tslint-language-service": "0.9.8",
|
||||
"tslint-webpack-plugin": "1.2.0",
|
||||
"typescript": "2.7.2",
|
||||
"typescript": "2.8.0-rc",
|
||||
"webpack": "4.1.1",
|
||||
"webpack-cli": "2.0.12",
|
||||
"webpack-node-externals": "1.6.0"
|
||||
|
||||
@@ -26,11 +26,11 @@ export class EsprimaFacade {
|
||||
let lastMeta: esprima.NodeMeta | null = null;
|
||||
|
||||
try {
|
||||
return esprima.parseScript(input, config, (node: ESTree.Node, meta: any) => lastMeta = meta);
|
||||
return esprima.parseScript(input, config, (node: ESTree.Node, meta: esprima.NodeMeta) => lastMeta = meta);
|
||||
} catch {}
|
||||
|
||||
try {
|
||||
return esprima.parseModule(input, config, (node: ESTree.Node, meta: any) => lastMeta = meta);
|
||||
return esprima.parseModule(input, config, (node: ESTree.Node, meta: esprima.NodeMeta) => lastMeta = meta);
|
||||
} catch (error) {
|
||||
return EsprimaFacade.processParsingError(input, error.message, lastMeta);
|
||||
}
|
||||
|
||||
@@ -85,7 +85,7 @@ function wrapTargetMethodsInInitializedCheck (target: IInitializable, initialize
|
||||
return;
|
||||
}
|
||||
|
||||
const targetProperty: any = target[propertyName];
|
||||
const targetProperty: IInitializable[keyof IInitializable] = target[propertyName];
|
||||
|
||||
if (typeof targetProperty !== 'function') {
|
||||
return;
|
||||
@@ -128,14 +128,14 @@ function wrapInitializeMethodInInitializeCheck (
|
||||
|
||||
Object.defineProperty(target, initializeMethodName, {
|
||||
...methodDescriptor,
|
||||
value: function (): void {
|
||||
value: function (): typeof originalMethod {
|
||||
/**
|
||||
* should define metadata before `initialize` method call,
|
||||
* because of cases when other methods will called inside `initialize` method
|
||||
*/
|
||||
Reflect.defineMetadata(initializedTargetMetadataKey, true, this);
|
||||
|
||||
const result: any = originalMethod.apply(this, arguments);
|
||||
const result: typeof originalMethod = originalMethod.apply(this, arguments);
|
||||
|
||||
if (this[propertyKey]) {}
|
||||
|
||||
|
||||
+1
-1
@@ -254,7 +254,7 @@ export class StringLiteralObfuscatingReplacer extends AbstractObfuscatingReplace
|
||||
const stringArrayIdentifierNode: ESTree.Identifier = NodeFactory.identifierNode(stringArrayStorageCallsWrapperName);
|
||||
|
||||
// prevent obfuscation of this identifier
|
||||
NodeMetadata.set(stringArrayIdentifierNode, { obfuscatedNode: true });
|
||||
NodeMetadata.set(stringArrayIdentifierNode, { renamedIdentifier: true });
|
||||
|
||||
return NodeFactory.callExpressionNode(
|
||||
stringArrayIdentifierNode,
|
||||
|
||||
@@ -4,8 +4,6 @@ import { ServiceIdentifiers } from '../../container/ServiceIdentifiers';
|
||||
import * as ESTree from 'estree';
|
||||
import jsStringEscape from 'js-string-escape';
|
||||
|
||||
import { TStatement } from '../../types/node/TStatement';
|
||||
|
||||
import { IOptions } from '../../interfaces/options/IOptions';
|
||||
import { IRandomGenerator } from '../../interfaces/utils/IRandomGenerator';
|
||||
import { IVisitor } from '../../interfaces/node-transformers/IVisitor';
|
||||
@@ -133,7 +131,7 @@ export class EvalCallExpressionTransformer extends AbstractNodeTransformer {
|
||||
return callExpressionNode;
|
||||
}
|
||||
|
||||
let ast: TStatement[];
|
||||
let ast: ESTree.Statement[];
|
||||
|
||||
// wrapping into try-catch to prevent parsing of incorrect `eval` string
|
||||
try {
|
||||
@@ -147,7 +145,7 @@ export class EvalCallExpressionTransformer extends AbstractNodeTransformer {
|
||||
* This function expression node will help to correctly transform AST-tree.
|
||||
*/
|
||||
const evalRootAstHostNode: ESTree.FunctionExpression = NodeFactory
|
||||
.functionExpressionNode([], NodeFactory.blockStatementNode(<any>ast));
|
||||
.functionExpressionNode([], NodeFactory.blockStatementNode(ast));
|
||||
|
||||
/**
|
||||
* we should store that host node and then extract AST-tree on the `finalizing` stage
|
||||
|
||||
@@ -41,9 +41,9 @@ export class NodeUtils {
|
||||
|
||||
/**
|
||||
* @param {string} code
|
||||
* @returns {TStatement[]}
|
||||
* @returns {Statement[]}
|
||||
*/
|
||||
public static convertCodeToStructure (code: string): TStatement[] {
|
||||
public static convertCodeToStructure (code: string): ESTree.Statement[] {
|
||||
let structure: ESTree.Program = esprima.parseScript(code);
|
||||
|
||||
structure = NodeUtils.addXVerbatimPropertyToLiterals(structure);
|
||||
@@ -60,7 +60,7 @@ export class NodeUtils {
|
||||
}
|
||||
});
|
||||
|
||||
return structure.body;
|
||||
return <ESTree.Statement[]>structure.body;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -168,9 +168,9 @@ export class NodeUtils {
|
||||
continue;
|
||||
}
|
||||
|
||||
const value: any = node[property];
|
||||
const value: T[keyof T] = node[property];
|
||||
|
||||
let clonedValue: any | null;
|
||||
let clonedValue: T[keyof T] | T[keyof T][] | null;
|
||||
|
||||
if (value === null || value instanceof RegExp) {
|
||||
clonedValue = value;
|
||||
|
||||
@@ -246,7 +246,7 @@
|
||||
|
||||
"@babel/plugin-transform-computed-properties@7.0.0-beta.40":
|
||||
version "7.0.0-beta.40"
|
||||
resolved "http://registry.npmjs.org/@babel/plugin-transform-computed-properties/-/plugin-transform-computed-properties-7.0.0-beta.40.tgz#e4bd53455d9f96882cc8e9923895d71690f6969e"
|
||||
resolved "https://registry.yarnpkg.com/@babel/plugin-transform-computed-properties/-/plugin-transform-computed-properties-7.0.0-beta.40.tgz#e4bd53455d9f96882cc8e9923895d71690f6969e"
|
||||
|
||||
"@babel/plugin-transform-destructuring@7.0.0-beta.40":
|
||||
version "7.0.0-beta.40"
|
||||
@@ -1527,7 +1527,7 @@ babylon@7.0.0-beta.27:
|
||||
|
||||
babylon@7.0.0-beta.40, babylon@^7.0.0-beta.30:
|
||||
version "7.0.0-beta.40"
|
||||
resolved "http://registry.npmjs.org/babylon/-/babylon-7.0.0-beta.40.tgz#91fc8cd56d5eb98b28e6fde41045f2957779940a"
|
||||
resolved "https://registry.yarnpkg.com/babylon/-/babylon-7.0.0-beta.40.tgz#91fc8cd56d5eb98b28e6fde41045f2957779940a"
|
||||
|
||||
babylon@^6.17.3, babylon@^6.18.0:
|
||||
version "6.18.0"
|
||||
@@ -2052,7 +2052,7 @@ commander@2.11.0:
|
||||
version "2.11.0"
|
||||
resolved "https://registry.yarnpkg.com/commander/-/commander-2.11.0.tgz#157152fd1e7a6c8d98a5b715cf376df928004563"
|
||||
|
||||
commander@2.15.0:
|
||||
commander@2.15.0, commander@^2.8.1:
|
||||
version "2.15.0"
|
||||
resolved "https://registry.yarnpkg.com/commander/-/commander-2.15.0.tgz#ad2a23a1c3b036e392469b8012cec6b33b4c1322"
|
||||
|
||||
@@ -2060,10 +2060,6 @@ commander@^2.12.1, commander@~2.13.0:
|
||||
version "2.13.0"
|
||||
resolved "https://registry.yarnpkg.com/commander/-/commander-2.13.0.tgz#6964bca67685df7c1f1430c584f07d7597885b9c"
|
||||
|
||||
commander@^2.8.1:
|
||||
version "2.14.1"
|
||||
resolved "https://registry.yarnpkg.com/commander/-/commander-2.14.1.tgz#2235123e37af8ca3c65df45b026dbd357b01b9aa"
|
||||
|
||||
commondir@^1.0.1:
|
||||
version "1.0.1"
|
||||
resolved "https://registry.yarnpkg.com/commondir/-/commondir-1.0.1.tgz#ddd800da0c66127393cca5950ea968a3aaf1253b"
|
||||
@@ -2763,8 +2759,8 @@ from2@^2.1.0, from2@^2.1.1:
|
||||
readable-stream "^2.0.0"
|
||||
|
||||
fs-readdir-recursive@^1.0.0:
|
||||
version "1.0.0"
|
||||
resolved "https://registry.yarnpkg.com/fs-readdir-recursive/-/fs-readdir-recursive-1.0.0.tgz#8cd1745c8b4f8a29c8caec392476921ba195f560"
|
||||
version "1.1.0"
|
||||
resolved "https://registry.yarnpkg.com/fs-readdir-recursive/-/fs-readdir-recursive-1.1.0.tgz#e32fc030a2ccee44a6b5371308da54be0b397d27"
|
||||
|
||||
fs-write-stream-atomic@^1.0.8:
|
||||
version "1.0.10"
|
||||
@@ -5787,9 +5783,9 @@ typedarray@^0.0.6:
|
||||
version "0.0.6"
|
||||
resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777"
|
||||
|
||||
typescript@2.7.2:
|
||||
version "2.7.2"
|
||||
resolved "https://registry.yarnpkg.com/typescript/-/typescript-2.7.2.tgz#2d615a1ef4aee4f574425cdff7026edf81919836"
|
||||
typescript@2.8.0-rc:
|
||||
version "2.8.0-rc"
|
||||
resolved "https://registry.yarnpkg.com/typescript/-/typescript-2.8.0-rc.tgz#a0256b7d1d39fb7493ba0403f55e95d31e8bc374"
|
||||
|
||||
uglify-es@^3.3.4:
|
||||
version "3.3.9"
|
||||
|
||||
Reference in New Issue
Block a user