Ver Fonte

Removed few any

sanex3339 há 7 anos atrás
pai
commit
469c51d69d

Diff do ficheiro suprimidas por serem muito extensas
+ 0 - 1139
dist/index.js


+ 1 - 1
package.json

@@ -74,7 +74,7 @@
     "tslint-eslint-rules": "5.1.0",
     "tslint-eslint-rules": "5.1.0",
     "tslint-language-service": "0.9.8",
     "tslint-language-service": "0.9.8",
     "tslint-webpack-plugin": "1.2.0",
     "tslint-webpack-plugin": "1.2.0",
-    "typescript": "2.7.2",
+    "typescript": "2.8.0-rc",
     "webpack": "4.1.1",
     "webpack": "4.1.1",
     "webpack-cli": "2.0.12",
     "webpack-cli": "2.0.12",
     "webpack-node-externals": "1.6.0"
     "webpack-node-externals": "1.6.0"

+ 2 - 2
src/EsprimaFacade.ts

@@ -26,11 +26,11 @@ export class EsprimaFacade {
         let lastMeta: esprima.NodeMeta | null = null;
         let lastMeta: esprima.NodeMeta | null = null;
 
 
         try {
         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 {}
         } catch {}
 
 
         try {
         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) {
         } catch (error) {
             return EsprimaFacade.processParsingError(input, error.message, lastMeta);
             return EsprimaFacade.processParsingError(input, error.message, lastMeta);
         }
         }

+ 3 - 3
src/decorators/Initializable.ts

@@ -85,7 +85,7 @@ function wrapTargetMethodsInInitializedCheck (target: IInitializable, initialize
             return;
             return;
         }
         }
 
 
-        const targetProperty: any = target[propertyName];
+        const targetProperty: IInitializable[keyof IInitializable] = target[propertyName];
 
 
         if (typeof targetProperty !== 'function') {
         if (typeof targetProperty !== 'function') {
             return;
             return;
@@ -128,14 +128,14 @@ function wrapInitializeMethodInInitializeCheck (
 
 
     Object.defineProperty(target, initializeMethodName, {
     Object.defineProperty(target, initializeMethodName, {
         ...methodDescriptor,
         ...methodDescriptor,
-        value: function (): void {
+        value: function (): typeof originalMethod {
             /**
             /**
              * should define metadata before `initialize` method call,
              * should define metadata before `initialize` method call,
              * because of cases when other methods will called inside `initialize` method
              * because of cases when other methods will called inside `initialize` method
              */
              */
             Reflect.defineMetadata(initializedTargetMetadataKey, true, this);
             Reflect.defineMetadata(initializedTargetMetadataKey, true, this);
 
 
-            const result: any = originalMethod.apply(this, arguments);
+            const result: typeof originalMethod = originalMethod.apply(this, arguments);
 
 
             if (this[propertyKey]) {}
             if (this[propertyKey]) {}
 
 

+ 1 - 1
src/node-transformers/obfuscating-transformers/obfuscating-replacers/literal-obfuscating-replacers/StringLiteralObfuscatingReplacer.ts

@@ -254,7 +254,7 @@ export class StringLiteralObfuscatingReplacer extends AbstractObfuscatingReplace
         const stringArrayIdentifierNode: ESTree.Identifier = NodeFactory.identifierNode(stringArrayStorageCallsWrapperName);
         const stringArrayIdentifierNode: ESTree.Identifier = NodeFactory.identifierNode(stringArrayStorageCallsWrapperName);
 
 
         // prevent obfuscation of this identifier
         // prevent obfuscation of this identifier
-        NodeMetadata.set(stringArrayIdentifierNode, { obfuscatedNode: true });
+        NodeMetadata.set(stringArrayIdentifierNode, { renamedIdentifier: true });
 
 
         return NodeFactory.callExpressionNode(
         return NodeFactory.callExpressionNode(
             stringArrayIdentifierNode,
             stringArrayIdentifierNode,

+ 2 - 4
src/node-transformers/preparing-transformers/EvaCallExpressionTransformer.ts

@@ -4,8 +4,6 @@ import { ServiceIdentifiers } from '../../container/ServiceIdentifiers';
 import * as ESTree from 'estree';
 import * as ESTree from 'estree';
 import jsStringEscape from 'js-string-escape';
 import jsStringEscape from 'js-string-escape';
 
 
-import { TStatement } from '../../types/node/TStatement';
-
 import { IOptions } from '../../interfaces/options/IOptions';
 import { IOptions } from '../../interfaces/options/IOptions';
 import { IRandomGenerator } from '../../interfaces/utils/IRandomGenerator';
 import { IRandomGenerator } from '../../interfaces/utils/IRandomGenerator';
 import { IVisitor } from '../../interfaces/node-transformers/IVisitor';
 import { IVisitor } from '../../interfaces/node-transformers/IVisitor';
@@ -133,7 +131,7 @@ export class EvalCallExpressionTransformer extends AbstractNodeTransformer {
             return callExpressionNode;
             return callExpressionNode;
         }
         }
 
 
-        let ast: TStatement[];
+        let ast: ESTree.Statement[];
 
 
         // wrapping into try-catch to prevent parsing of incorrect `eval` string
         // wrapping into try-catch to prevent parsing of incorrect `eval` string
         try {
         try {
@@ -147,7 +145,7 @@ export class EvalCallExpressionTransformer extends AbstractNodeTransformer {
          * This function expression node will help to correctly transform AST-tree.
          * This function expression node will help to correctly transform AST-tree.
          */
          */
         const evalRootAstHostNode: ESTree.FunctionExpression = NodeFactory
         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
          * we should store that host node and then extract AST-tree on the `finalizing` stage

+ 5 - 5
src/node/NodeUtils.ts

@@ -41,9 +41,9 @@ export class NodeUtils {
 
 
     /**
     /**
      * @param {string} code
      * @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);
         let structure: ESTree.Program = esprima.parseScript(code);
 
 
         structure = NodeUtils.addXVerbatimPropertyToLiterals(structure);
         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;
                 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) {
             if (value === null || value instanceof RegExp) {
                 clonedValue = value;
                 clonedValue = value;

+ 8 - 12
yarn.lock

@@ -246,7 +246,7 @@
 
 
 "@babel/[email protected]":
 "@babel/[email protected]":
   version "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/[email protected]":
 "@babel/[email protected]":
   version "7.0.0-beta.40"
   version "7.0.0-beta.40"
@@ -1527,7 +1527,7 @@ [email protected]:
 
 
 [email protected], babylon@^7.0.0-beta.30:
 [email protected], babylon@^7.0.0-beta.30:
   version "7.0.0-beta.40"
   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:
 babylon@^6.17.3, babylon@^6.18.0:
   version "6.18.0"
   version "6.18.0"
@@ -2052,7 +2052,7 @@ [email protected]:
   version "2.11.0"
   version "2.11.0"
   resolved "https://registry.yarnpkg.com/commander/-/commander-2.11.0.tgz#157152fd1e7a6c8d98a5b715cf376df928004563"
   resolved "https://registry.yarnpkg.com/commander/-/commander-2.11.0.tgz#157152fd1e7a6c8d98a5b715cf376df928004563"
 
 
[email protected]:
[email protected], commander@^2.8.1:
   version "2.15.0"
   version "2.15.0"
   resolved "https://registry.yarnpkg.com/commander/-/commander-2.15.0.tgz#ad2a23a1c3b036e392469b8012cec6b33b4c1322"
   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"
   version "2.13.0"
   resolved "https://registry.yarnpkg.com/commander/-/commander-2.13.0.tgz#6964bca67685df7c1f1430c584f07d7597885b9c"
   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:
 commondir@^1.0.1:
   version "1.0.1"
   version "1.0.1"
   resolved "https://registry.yarnpkg.com/commondir/-/commondir-1.0.1.tgz#ddd800da0c66127393cca5950ea968a3aaf1253b"
   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"
     readable-stream "^2.0.0"
 
 
 fs-readdir-recursive@^1.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:
 fs-write-stream-atomic@^1.0.8:
   version "1.0.10"
   version "1.0.10"
@@ -5787,9 +5783,9 @@ typedarray@^0.0.6:
   version "0.0.6"
   version "0.0.6"
   resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777"
   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:
 uglify-es@^3.3.4:
   version "3.3.9"
   version "3.3.9"

Alguns ficheiros não foram mostrados porque muitos ficheiros mudaram neste diff