sanex3339 9 anni fa
parent
commit
ea27616627

+ 98 - 164
dist/index.js

@@ -53,7 +53,7 @@ module.exports =
 /******/ 	__webpack_require__.p = "";
 
 /******/ 	// Load entry module and return exports
-/******/ 	return __webpack_require__(__webpack_require__.s = 15);
+/******/ 	return __webpack_require__(__webpack_require__.s = 14);
 /******/ })
 /************************************************************************/
 /******/ ([
@@ -455,7 +455,7 @@ module.exports =
 	    _createClass(NodeObfuscator, [{
 	        key: "isReservedName",
 	        value: function isReservedName(name) {
-	            return this.options.getOption('reservedNames').some(function (reservedName) {
+	            return this.options.get('reservedNames').some(function (reservedName) {
 	                return new RegExp(reservedName, 'g').test(name);
 	            });
 	        }
@@ -489,12 +489,12 @@ module.exports =
 	        key: "replaceLiteralValueByUnicodeValue",
 	        value: function replaceLiteralValueByUnicodeValue(nodeValue) {
 	            var value = nodeValue,
-	                replaceByUnicodeArrayFlag = Math.random() <= this.options.getOption('unicodeArrayThreshold');
-	            if (this.options.getOption('encodeUnicodeLiterals') && replaceByUnicodeArrayFlag) {
+	                replaceByUnicodeArrayFlag = Math.random() <= this.options.get('unicodeArrayThreshold');
+	            if (this.options.get('encodeUnicodeLiterals') && replaceByUnicodeArrayFlag) {
 	                value = Utils_1.Utils.btoa(value);
 	            }
 	            value = Utils_1.Utils.stringToUnicode(value);
-	            if (!this.options.getOption('unicodeArray') || !replaceByUnicodeArrayFlag) {
+	            if (!this.options.get('unicodeArray') || !replaceByUnicodeArrayFlag) {
 	                return value;
 	            }
 	            return this.replaceLiteralValueByUnicodeArrayCall(value);
@@ -514,7 +514,7 @@ module.exports =
 	                unicodeArrayNode.updateNodeData(value);
 	            }
 	            hexadecimalIndex = this.replaceLiteralNumberByHexadecimalValue(index);
-	            if (this.options.getOption('wrapUnicodeArrayCalls')) {
+	            if (this.options.get('wrapUnicodeArrayCalls')) {
 	                return this.nodes.get('unicodeArrayCallsWrapper').getNodeIdentifier() + "('" + hexadecimalIndex + "')";
 	            }
 	            return unicodeArrayNode.getNodeIdentifier() + "[" + hexadecimalIndex + "]";
@@ -627,9 +627,10 @@ module.exports =
 
 	function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
 
-	var Kernel_1 = __webpack_require__(16);
 	var esprima = __webpack_require__(7);
 	var escodegen = __webpack_require__(9);
+	var Obfuscator_1 = __webpack_require__(15);
+	var Options_1 = __webpack_require__(16);
 
 	var JavaScriptObfuscator = function () {
 	    function JavaScriptObfuscator() {
@@ -637,21 +638,20 @@ module.exports =
 	    }
 
 	    _createClass(JavaScriptObfuscator, null, [{
-	        key: "obfuscate",
+	        key: 'obfuscate',
 	        value: function obfuscate(sourceCode, customOptions) {
 	            var astTree = esprima.parse(sourceCode),
-	                options = Kernel_1.default.get('IOptions'),
-	                obfuscator = Kernel_1.default.get('IObfuscator');
-	            options.assign(customOptions);
+	                options = new Options_1.Options(customOptions),
+	                obfuscator = new Obfuscator_1.Obfuscator(options);
 	            astTree = obfuscator.obfuscateNode(astTree);
 	            return JavaScriptObfuscator.generateCode(astTree, options);
 	        }
 	    }, {
-	        key: "generateCode",
+	        key: 'generateCode',
 	        value: function generateCode(astTree, options) {
 	            var escodegenParams = Object.assign({}, JavaScriptObfuscator.escodegenParams);
 	            escodegenParams.format = {
-	                compact: options.getOption('compact')
+	                compact: options.get('compact')
 	            };
 	            return escodegen.generate(astTree, escodegenParams);
 	        }
@@ -719,45 +719,23 @@ module.exports =
 
 /***/ },
 /* 13 */
-/***/ function(module, exports) {
-
-	module.exports = require("inversify");
-
-/***/ },
-/* 14 */
 /***/ function(module, exports) {
 
 	module.exports = require("babel-polyfill");
 
 /***/ },
-/* 15 */
+/* 14 */
 /***/ function(module, exports, __webpack_require__) {
 
 	"use strict";
 	"use strict";
 
-	__webpack_require__(14);
+	__webpack_require__(13);
 	var JavaScriptObfuscator_1 = __webpack_require__(10);
 	module.exports = JavaScriptObfuscator_1.JavaScriptObfuscator;
 
 /***/ },
-/* 16 */
-/***/ function(module, exports, __webpack_require__) {
-
-	"use strict";
-	"use strict";
-
-	var inversify_1 = __webpack_require__(13);
-	var Obfuscator_1 = __webpack_require__(17);
-	var Options_1 = __webpack_require__(18);
-	var kernel = new inversify_1.Kernel();
-	kernel.bind('IOptions').to(Options_1.Options).inSingletonScope();
-	kernel.bind('IObfuscator').to(Obfuscator_1.Obfuscator);
-	Object.defineProperty(exports, "__esModule", { value: true });
-	exports.default = kernel;
-
-/***/ },
-/* 17 */
+/* 15 */
 /***/ function(module, exports, __webpack_require__) {
 
 	"use strict";
@@ -765,43 +743,25 @@ module.exports =
 
 	var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
 
-	var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol ? "symbol" : typeof obj; };
-
 	function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
 
-	var __decorate = undefined && undefined.__decorate || function (decorators, target, key, desc) {
-	    var c = arguments.length,
-	        r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc,
-	        d;
-	    if ((typeof Reflect === "undefined" ? "undefined" : _typeof(Reflect)) === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);else for (var i = decorators.length - 1; i >= 0; i--) {
-	        if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
-	    }return c > 3 && r && Object.defineProperty(target, key, r), r;
-	};
-	var __metadata = undefined && undefined.__metadata || function (k, v) {
-	    if ((typeof Reflect === "undefined" ? "undefined" : _typeof(Reflect)) === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
-	};
-	var __param = undefined && undefined.__param || function (paramIndex, decorator) {
-	    return function (target, key) {
-	        decorator(target, key, paramIndex);
-	    };
-	};
-	var inversify_1 = __webpack_require__(13);
 	var estraverse = __webpack_require__(4);
 	var AppendState_1 = __webpack_require__(6);
 	var NodeType_1 = __webpack_require__(3);
-	var CatchClauseObfuscator_1 = __webpack_require__(31);
-	var ConsoleOutputDisableExpressionNode_1 = __webpack_require__(19);
-	var DebugProtectionNodesGroup_1 = __webpack_require__(28);
-	var FunctionDeclarationObfuscator_1 = __webpack_require__(32);
-	var FunctionObfuscator_1 = __webpack_require__(33);
-	var LiteralObfuscator_1 = __webpack_require__(34);
-	var MemberExpressionObfuscator_1 = __webpack_require__(35);
-	var MethodDefinitionObfuscator_1 = __webpack_require__(36);
+	var CatchClauseObfuscator_1 = __webpack_require__(29);
+	var ConsoleOutputDisableExpressionNode_1 = __webpack_require__(17);
+	var DebugProtectionNodesGroup_1 = __webpack_require__(26);
+	var FunctionDeclarationObfuscator_1 = __webpack_require__(30);
+	var FunctionObfuscator_1 = __webpack_require__(31);
+	var LiteralObfuscator_1 = __webpack_require__(32);
+	var MemberExpressionObfuscator_1 = __webpack_require__(33);
+	var MethodDefinitionObfuscator_1 = __webpack_require__(34);
 	var NodeUtils_1 = __webpack_require__(0);
-	var ObjectExpressionObfuscator_1 = __webpack_require__(37);
-	var SelfDefendingNodesGroup_1 = __webpack_require__(29);
-	var UnicodeArrayNodesGroup_1 = __webpack_require__(30);
-	var VariableDeclarationObfuscator_1 = __webpack_require__(38);
+	var ObjectExpressionObfuscator_1 = __webpack_require__(35);
+	var SelfDefendingNodesGroup_1 = __webpack_require__(27);
+	var UnicodeArrayNodesGroup_1 = __webpack_require__(28);
+	var VariableDeclarationObfuscator_1 = __webpack_require__(36);
+
 	var Obfuscator = function () {
 	    function Obfuscator(options) {
 	        _classCallCheck(this, Obfuscator);
@@ -812,7 +772,7 @@ module.exports =
 	    }
 
 	    _createClass(Obfuscator, [{
-	        key: "obfuscateNode",
+	        key: 'obfuscateNode',
 	        value: function obfuscateNode(node) {
 	            this.setNewNodes();
 	            NodeUtils_1.NodeUtils.parentize(node);
@@ -822,12 +782,12 @@ module.exports =
 	            return node;
 	        }
 	    }, {
-	        key: "setNode",
+	        key: 'setNode',
 	        value: function setNode(nodeName, node) {
 	            this.nodes.set(nodeName, node);
 	        }
 	    }, {
-	        key: "setNodesGroup",
+	        key: 'setNodesGroup',
 	        value: function setNodesGroup(nodesGroup) {
 	            var _this = this;
 
@@ -837,7 +797,7 @@ module.exports =
 	            });
 	        }
 	    }, {
-	        key: "afterObfuscation",
+	        key: 'afterObfuscation',
 	        value: function afterObfuscation(astTree) {
 	            this.nodes.forEach(function (node) {
 	                if (node.getAppendState() === AppendState_1.AppendState.AfterObfuscation) {
@@ -846,7 +806,7 @@ module.exports =
 	            });
 	        }
 	    }, {
-	        key: "beforeObfuscation",
+	        key: 'beforeObfuscation',
 	        value: function beforeObfuscation(astTree) {
 	            this.nodes.forEach(function (node) {
 	                if (node.getAppendState() === AppendState_1.AppendState.BeforeObfuscation) {
@@ -855,7 +815,7 @@ module.exports =
 	            });
 	        }
 	    }, {
-	        key: "initializeNodeObfuscators",
+	        key: 'initializeNodeObfuscators',
 	        value: function initializeNodeObfuscators(node, parentNode) {
 	            var _this2 = this;
 
@@ -867,7 +827,7 @@ module.exports =
 	            });
 	        }
 	    }, {
-	        key: "obfuscate",
+	        key: 'obfuscate',
 	        value: function obfuscate(node) {
 	            var _this3 = this;
 
@@ -878,18 +838,18 @@ module.exports =
 	            });
 	        }
 	    }, {
-	        key: "setNewNodes",
+	        key: 'setNewNodes',
 	        value: function setNewNodes() {
-	            if (this.options.getOption('selfDefending')) {
+	            if (this.options.get('selfDefending')) {
 	                this.setNodesGroup(new SelfDefendingNodesGroup_1.SelfDefendingNodesGroup(this.options));
 	            }
-	            if (this.options.getOption('disableConsoleOutput')) {
+	            if (this.options.get('disableConsoleOutput')) {
 	                this.setNode('consoleOutputDisableExpressionNode', new ConsoleOutputDisableExpressionNode_1.ConsoleOutputDisableExpressionNode(this.options));
 	            }
-	            if (this.options.getOption('debugProtection')) {
+	            if (this.options.get('debugProtection')) {
 	                this.setNodesGroup(new DebugProtectionNodesGroup_1.DebugProtectionNodesGroup(this.options));
 	            }
-	            if (this.options.getOption('unicodeArray')) {
+	            if (this.options.get('unicodeArray')) {
 	                this.setNodesGroup(new UnicodeArrayNodesGroup_1.UnicodeArrayNodesGroup(this.options));
 	            }
 	        }
@@ -897,11 +857,11 @@ module.exports =
 
 	    return Obfuscator;
 	}();
-	Obfuscator = __decorate([inversify_1.injectable(), __param(0, inversify_1.inject('IOptions')), __metadata('design:paramtypes', [Object])], Obfuscator);
+
 	exports.Obfuscator = Obfuscator;
 
 /***/ },
-/* 18 */
+/* 16 */
 /***/ function(module, exports, __webpack_require__) {
 
 	"use strict";
@@ -909,62 +869,36 @@ module.exports =
 
 	var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
 
-	var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol ? "symbol" : typeof obj; };
-
 	function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
 
-	var __decorate = undefined && undefined.__decorate || function (decorators, target, key, desc) {
-	    var c = arguments.length,
-	        r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc,
-	        d;
-	    if ((typeof Reflect === "undefined" ? "undefined" : _typeof(Reflect)) === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);else for (var i = decorators.length - 1; i >= 0; i--) {
-	        if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
-	    }return c > 3 && r && Object.defineProperty(target, key, r), r;
-	};
-	var __metadata = undefined && undefined.__metadata || function (k, v) {
-	    if ((typeof Reflect === "undefined" ? "undefined" : _typeof(Reflect)) === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
-	};
-	var inversify_1 = __webpack_require__(13);
-	var DefaultPreset_1 = __webpack_require__(39);
-	var Options_1 = void 0;
-	var Options = Options_1 = function () {
-	    function Options() {
+	var DefaultPreset_1 = __webpack_require__(37);
+
+	var Options = function () {
+	    function Options(options) {
 	        _classCallCheck(this, Options);
+
+	        this.options = Object.freeze(Options.normalizeOptions(Object.assign({}, DefaultPreset_1.DEFAULT_PRESET, options)));
 	    }
 
 	    _createClass(Options, [{
-	        key: "assign",
-	        value: function assign(options) {
-	            if (this.options) {
-	                throw new Error('Options object can\'t be reassigned!');
-	            }
-	            this.options = Object.assign({}, DefaultPreset_1.DEFAULT_PRESET, options);
-	            this.normalizeOptions();
-	        }
-	    }, {
-	        key: "getOption",
-	        value: function getOption(optionName) {
+	        key: "get",
+	        value: function get(optionName) {
 	            return this.options[optionName];
 	        }
-	    }, {
-	        key: "getOptions",
-	        value: function getOptions() {
-	            return this.options;
-	        }
-	    }, {
+	    }], [{
 	        key: "normalizeOptions",
-	        value: function normalizeOptions() {
-	            var normalizedOptions = Object.assign({}, this.options);
-	            normalizedOptions = Options_1.unicodeArrayRule(normalizedOptions);
-	            normalizedOptions = Options_1.unicodeArrayThresholdRule(normalizedOptions);
-	            normalizedOptions = Options_1.selfDefendingRule(normalizedOptions);
-	            this.options = Object.freeze(normalizedOptions);
+	        value: function normalizeOptions(options) {
+	            var normalizedOptions = Object.assign({}, options);
+	            normalizedOptions = Options.unicodeArrayRule(normalizedOptions);
+	            normalizedOptions = Options.unicodeArrayThresholdRule(normalizedOptions);
+	            normalizedOptions = Options.selfDefendingRule(normalizedOptions);
+	            return normalizedOptions;
 	        }
-	    }], [{
+	    }, {
 	        key: "selfDefendingRule",
 	        value: function selfDefendingRule(options) {
 	            if (options['selfDefending']) {
-	                Object.assign(options, Options_1.SELF_DEFENDING_OPTIONS);
+	                Object.assign(options, Options.SELF_DEFENDING_OPTIONS);
 	            }
 	            return options;
 	        }
@@ -972,7 +906,7 @@ module.exports =
 	        key: "unicodeArrayRule",
 	        value: function unicodeArrayRule(options) {
 	            if (!options['unicodeArray']) {
-	                Object.assign(options, Options_1.DISABLED_UNICODE_ARRAY_OPTIONS);
+	                Object.assign(options, Options.DISABLED_UNICODE_ARRAY_OPTIONS);
 	            }
 	            return options;
 	        }
@@ -988,6 +922,7 @@ module.exports =
 
 	    return Options;
 	}();
+
 	Options.DISABLED_UNICODE_ARRAY_OPTIONS = {
 	    encodeUnicodeLiterals: false,
 	    rotateUnicodeArray: false,
@@ -999,11 +934,10 @@ module.exports =
 	    compact: true,
 	    selfDefending: true
 	};
-	Options = Options_1 = __decorate([inversify_1.injectable(), __metadata('design:paramtypes', [])], Options);
 	exports.Options = Options;
 
 /***/ },
-/* 19 */
+/* 17 */
 /***/ function(module, exports, __webpack_require__) {
 
 	"use strict";
@@ -1051,7 +985,7 @@ module.exports =
 	exports.ConsoleOutputDisableExpressionNode = ConsoleOutputDisableExpressionNode;
 
 /***/ },
-/* 20 */
+/* 18 */
 /***/ function(module, exports, __webpack_require__) {
 
 	"use strict";
@@ -1110,7 +1044,7 @@ module.exports =
 	exports.DebugProtectionFunctionCallNode = DebugProtectionFunctionCallNode;
 
 /***/ },
-/* 21 */
+/* 19 */
 /***/ function(module, exports, __webpack_require__) {
 
 	"use strict";
@@ -1194,7 +1128,7 @@ module.exports =
 	exports.DebugProtectionFunctionIntervalNode = DebugProtectionFunctionIntervalNode;
 
 /***/ },
-/* 22 */
+/* 20 */
 /***/ function(module, exports, __webpack_require__) {
 
 	"use strict";
@@ -1251,7 +1185,7 @@ module.exports =
 	exports.DebugProtectionFunctionNode = DebugProtectionFunctionNode;
 
 /***/ },
-/* 23 */
+/* 21 */
 /***/ function(module, exports, __webpack_require__) {
 
 	"use strict";
@@ -1312,7 +1246,7 @@ module.exports =
 	exports.SelfDefendingUnicodeNode = SelfDefendingUnicodeNode;
 
 /***/ },
-/* 24 */
+/* 22 */
 /***/ function(module, exports, __webpack_require__) {
 
 	"use strict";
@@ -1386,7 +1320,7 @@ module.exports =
 	exports.UnicodeArrayCallsWrapper = UnicodeArrayCallsWrapper;
 
 /***/ },
-/* 25 */
+/* 23 */
 /***/ function(module, exports, __webpack_require__) {
 
 	"use strict";
@@ -1449,7 +1383,7 @@ module.exports =
 	                tempArrayName = Utils_1.Utils.getRandomVariableName();
 	            var code = '',
 	                node = void 0;
-	            if (this.options.getOption('selfDefending')) {
+	            if (this.options.get('selfDefending')) {
 	                code = '\n                var ' + environmentName + ' = function(){return ' + Utils_1.Utils.stringToUnicode('dev') + ';};\n                   \n                Function(' + Utils_1.Utils.stringToUnicode('return/\\w+ *\\(\\) *{\\w+ *[\'|"].+[\'|"];? *}/') + ')()[' + Utils_1.Utils.stringToUnicode('test') + '](' + environmentName + '[' + Utils_1.Utils.stringToUnicode('toString') + ']()) !== ' + JSFuck_1.JSFuck.True + ' && !' + this.unicodeArrayName + '++ ? [][\'filter\'][\'constructor\'](' + Utils_1.Utils.stringToJSFuck('while') + ' + \'(' + JSFuck_1.JSFuck.True + '){}\')() : Function(' + Utils_1.Utils.stringToUnicode('a') + ', atob(' + Utils_1.Utils.stringToUnicode(Utils_1.Utils.btoa('a.call()')) + '))(' + forLoopFunctionName + ') ? [][\'filter\'][\'constructor\'](' + Utils_1.Utils.stringToJSFuck('while') + ' + \'(' + JSFuck_1.JSFuck.False + '){}\')() : [][\'filter\'][\'constructor\'](' + Utils_1.Utils.stringToJSFuck('while') + ' + \'(' + JSFuck_1.JSFuck.False + '){}\')();\n            ';
 	            } else {
 	                code = forLoopFunctionName + '();';
@@ -1466,7 +1400,7 @@ module.exports =
 	exports.UnicodeArrayDecodeNode = UnicodeArrayDecodeNode;
 
 /***/ },
-/* 26 */
+/* 24 */
 /***/ function(module, exports, __webpack_require__) {
 
 	"use strict";
@@ -1576,7 +1510,7 @@ module.exports =
 	exports.UnicodeArrayNode = UnicodeArrayNode;
 
 /***/ },
-/* 27 */
+/* 25 */
 /***/ function(module, exports, __webpack_require__) {
 
 	"use strict";
@@ -1639,7 +1573,7 @@ module.exports =
 	                timesArgumentName = Utils_1.Utils.getRandomVariableName(),
 	                whileFunctionName = Utils_1.Utils.getRandomVariableName(),
 	                node = void 0;
-	            if (this.options.getOption('selfDefending')) {
+	            if (this.options.get('selfDefending')) {
 	                code = JavaScriptObfuscator_1.JavaScriptObfuscator.obfuscate("\n                (function () {\n                    var func = function(){return " + Utils_1.Utils.stringToUnicode('dev') + ";};\n                                        \n                    !Function(" + Utils_1.Utils.stringToUnicode("return/\\w+ *\\(\\) *{\\w+ *['|\"].+['|\"];? *}/") + ")().test(func.toString()) ? []['filter']['constructor'](" + Utils_1.Utils.stringToJSFuck('while') + " + '(" + JSFuck_1.JSFuck.True + "){}')() : Function(" + Utils_1.Utils.stringToUnicode('a') + ", " + Utils_1.Utils.stringToUnicode('b') + ", " + Utils_1.Utils.stringToUnicode('a(++b)') + ")(" + whileFunctionName + ", " + timesName + ") ? []['filter']['constructor'](" + Utils_1.Utils.stringToJSFuck('while') + " + '(" + JSFuck_1.JSFuck.False + "){}')() : []['filter']['constructor'](" + Utils_1.Utils.stringToJSFuck('while') + " + '(" + JSFuck_1.JSFuck.False + "){}')();\n                })();\n            ", NoCustomNodesPreset_1.NO_CUSTOM_NODES_PRESET);
 	            } else {
 	                code = whileFunctionName + "(++" + timesName + ")";
@@ -1656,7 +1590,7 @@ module.exports =
 	exports.UnicodeArrayRotateFunctionNode = UnicodeArrayRotateFunctionNode;
 
 /***/ },
-/* 28 */
+/* 26 */
 /***/ function(module, exports, __webpack_require__) {
 
 	"use strict";
@@ -1668,9 +1602,9 @@ module.exports =
 
 	function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
 
-	var DebugProtectionFunctionCallNode_1 = __webpack_require__(20);
-	var DebugProtectionFunctionIntervalNode_1 = __webpack_require__(21);
-	var DebugProtectionFunctionNode_1 = __webpack_require__(22);
+	var DebugProtectionFunctionCallNode_1 = __webpack_require__(18);
+	var DebugProtectionFunctionIntervalNode_1 = __webpack_require__(19);
+	var DebugProtectionFunctionNode_1 = __webpack_require__(20);
 	var NodesGroup_1 = __webpack_require__(11);
 	var Utils_1 = __webpack_require__(1);
 
@@ -1685,7 +1619,7 @@ module.exports =
 	        _this.debugProtectionFunctionIdentifier = Utils_1.Utils.getRandomVariableName();
 	        _this.nodes.set('debugProtectionFunctionNode', new DebugProtectionFunctionNode_1.DebugProtectionFunctionNode(_this.debugProtectionFunctionIdentifier, _this.options));
 	        _this.nodes.set('debugProtectionFunctionCallNode', new DebugProtectionFunctionCallNode_1.DebugProtectionFunctionCallNode(_this.debugProtectionFunctionIdentifier, _this.options));
-	        if (_this.options.getOption('debugProtectionInterval')) {
+	        if (_this.options.get('debugProtectionInterval')) {
 	            _this.nodes.set('debugProtectionFunctionIntervalNode', new DebugProtectionFunctionIntervalNode_1.DebugProtectionFunctionIntervalNode(_this.debugProtectionFunctionIdentifier, _this.options));
 	        }
 	        return _this;
@@ -1697,7 +1631,7 @@ module.exports =
 	exports.DebugProtectionNodesGroup = DebugProtectionNodesGroup;
 
 /***/ },
-/* 29 */
+/* 27 */
 /***/ function(module, exports, __webpack_require__) {
 
 	"use strict";
@@ -1710,7 +1644,7 @@ module.exports =
 	function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
 
 	var NodesGroup_1 = __webpack_require__(11);
-	var SelfDefendingUnicodeNode_1 = __webpack_require__(23);
+	var SelfDefendingUnicodeNode_1 = __webpack_require__(21);
 
 	var SelfDefendingNodesGroup = function (_NodesGroup_1$NodesGr) {
 	    _inherits(SelfDefendingNodesGroup, _NodesGroup_1$NodesGr);
@@ -1730,7 +1664,7 @@ module.exports =
 	exports.SelfDefendingNodesGroup = SelfDefendingNodesGroup;
 
 /***/ },
-/* 30 */
+/* 28 */
 /***/ function(module, exports, __webpack_require__) {
 
 	"use strict";
@@ -1743,10 +1677,10 @@ module.exports =
 	function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
 
 	var NodesGroup_1 = __webpack_require__(11);
-	var UnicodeArrayCallsWrapper_1 = __webpack_require__(24);
-	var UnicodeArrayDecodeNode_1 = __webpack_require__(25);
-	var UnicodeArrayNode_1 = __webpack_require__(26);
-	var UnicodeArrayRotateFunctionNode_1 = __webpack_require__(27);
+	var UnicodeArrayCallsWrapper_1 = __webpack_require__(22);
+	var UnicodeArrayDecodeNode_1 = __webpack_require__(23);
+	var UnicodeArrayNode_1 = __webpack_require__(24);
+	var UnicodeArrayRotateFunctionNode_1 = __webpack_require__(25);
 	var Utils_1 = __webpack_require__(1);
 
 	var UnicodeArrayNodesGroup = function (_NodesGroup_1$NodesGr) {
@@ -1759,17 +1693,17 @@ module.exports =
 
 	        _this.unicodeArrayName = Utils_1.Utils.getRandomVariableName(UnicodeArrayNode_1.UnicodeArrayNode.UNICODE_ARRAY_RANDOM_LENGTH);
 	        _this.unicodeArrayTranslatorName = Utils_1.Utils.getRandomVariableName(UnicodeArrayNode_1.UnicodeArrayNode.UNICODE_ARRAY_RANDOM_LENGTH);
-	        _this.unicodeArrayRotateValue = _this.options.getOption('rotateUnicodeArray') ? Utils_1.Utils.getRandomInteger(100, 500) : 0;
+	        _this.unicodeArrayRotateValue = _this.options.get('rotateUnicodeArray') ? Utils_1.Utils.getRandomInteger(100, 500) : 0;
 	        var unicodeArrayNode = new UnicodeArrayNode_1.UnicodeArrayNode(_this.unicodeArrayName, _this.unicodeArrayRotateValue, _this.options),
 	            unicodeArray = unicodeArrayNode.getNodeData();
 	        _this.nodes.set('unicodeArrayNode', unicodeArrayNode);
-	        if (_this.options.getOption('wrapUnicodeArrayCalls')) {
+	        if (_this.options.get('wrapUnicodeArrayCalls')) {
 	            _this.nodes.set('unicodeArrayCallsWrapper', new UnicodeArrayCallsWrapper_1.UnicodeArrayCallsWrapper(_this.unicodeArrayTranslatorName, _this.unicodeArrayName, unicodeArray, _this.options));
 	        }
-	        if (_this.options.getOption('encodeUnicodeLiterals')) {
+	        if (_this.options.get('encodeUnicodeLiterals')) {
 	            _this.nodes.set('unicodeArrayDecodeNode', new UnicodeArrayDecodeNode_1.UnicodeArrayDecodeNode(_this.unicodeArrayName, unicodeArray, _this.options));
 	        }
-	        if (_this.options.getOption('rotateUnicodeArray')) {
+	        if (_this.options.get('rotateUnicodeArray')) {
 	            _this.nodes.set('unicodeArrayRotateFunctionNode', new UnicodeArrayRotateFunctionNode_1.UnicodeArrayRotateFunctionNode(_this.unicodeArrayName, unicodeArray, _this.unicodeArrayRotateValue, _this.options));
 	        }
 	        return _this;
@@ -1781,7 +1715,7 @@ module.exports =
 	exports.UnicodeArrayNodesGroup = UnicodeArrayNodesGroup;
 
 /***/ },
-/* 31 */
+/* 29 */
 /***/ function(module, exports, __webpack_require__) {
 
 	"use strict";
@@ -1859,7 +1793,7 @@ module.exports =
 	exports.CatchClauseObfuscator = CatchClauseObfuscator;
 
 /***/ },
-/* 32 */
+/* 30 */
 /***/ function(module, exports, __webpack_require__) {
 
 	"use strict";
@@ -1942,7 +1876,7 @@ module.exports =
 	exports.FunctionDeclarationObfuscator = FunctionDeclarationObfuscator;
 
 /***/ },
-/* 33 */
+/* 31 */
 /***/ function(module, exports, __webpack_require__) {
 
 	"use strict";
@@ -2022,7 +1956,7 @@ module.exports =
 	exports.FunctionObfuscator = FunctionObfuscator;
 
 /***/ },
-/* 34 */
+/* 32 */
 /***/ function(module, exports, __webpack_require__) {
 
 	"use strict";
@@ -2087,7 +2021,7 @@ module.exports =
 	exports.LiteralObfuscator = LiteralObfuscator;
 
 /***/ },
-/* 35 */
+/* 33 */
 /***/ function(module, exports, __webpack_require__) {
 
 	"use strict";
@@ -2180,7 +2114,7 @@ module.exports =
 	exports.MemberExpressionObfuscator = MemberExpressionObfuscator;
 
 /***/ },
-/* 36 */
+/* 34 */
 /***/ function(module, exports, __webpack_require__) {
 
 	"use strict";
@@ -2246,7 +2180,7 @@ module.exports =
 	exports.MethodDefinitionObfuscator = MethodDefinitionObfuscator;
 
 /***/ },
-/* 37 */
+/* 35 */
 /***/ function(module, exports, __webpack_require__) {
 
 	"use strict";
@@ -2338,7 +2272,7 @@ module.exports =
 	exports.ObjectExpressionObfuscator = ObjectExpressionObfuscator;
 
 /***/ },
-/* 38 */
+/* 36 */
 /***/ function(module, exports, __webpack_require__) {
 
 	"use strict";
@@ -2437,7 +2371,7 @@ module.exports =
 	exports.VariableDeclarationObfuscator = VariableDeclarationObfuscator;
 
 /***/ },
-/* 39 */
+/* 37 */
 /***/ function(module, exports) {
 
 	"use strict";

+ 0 - 3
package.json

@@ -23,10 +23,7 @@
     "babel-loader": "^6.2.4",
     "babel-polyfill": "^6.9.1",
     "babel-preset-es2015": "^6.9.0",
-    "inversify": "^2.0.0-beta.8",
-    "inversify-dts": "^1.0.5",
     "lite-server": "^1.3.1",
-    "reflect-metadata": "^0.1.3",
     "ts-loader": "^0.8.2",
     "typings": "^0.8.1",
     "webpack": "^2.1.0-beta.12",

+ 6 - 7
src/JavaScriptObfuscator.ts

@@ -1,7 +1,5 @@
 "use strict";
 
-import kernel from "./Kernel";
-
 import * as esprima from 'esprima';
 import * as escodegen from 'escodegen';
 
@@ -10,6 +8,9 @@ import { IObfuscator } from "./interfaces/IObfuscator";
 import { IOptions } from './interfaces/IOptions';
 import { IOptionsPreset } from "./interfaces/IOptionsPreset";
 
+import { Obfuscator } from "./Obfuscator";
+import { Options } from "./Options";
+
 export class JavaScriptObfuscator {
     /**
      * @type {GenerateOptions}
@@ -24,10 +25,8 @@ export class JavaScriptObfuscator {
      */
     public static obfuscate (sourceCode: string, customOptions?: IOptionsPreset): string {
         let astTree: INode = esprima.parse(sourceCode),
-            options: IOptions = kernel.get<IOptions>('IOptions'),
-            obfuscator: IObfuscator = kernel.get<IObfuscator>('IObfuscator');
-
-        options.assign(customOptions);
+            options: IOptions = new Options(customOptions),
+            obfuscator: IObfuscator = new Obfuscator(options);
 
         astTree = obfuscator.obfuscateNode(astTree);
 
@@ -42,7 +41,7 @@ export class JavaScriptObfuscator {
         let escodegenParams: escodegen.GenerateOptions = Object.assign({}, JavaScriptObfuscator.escodegenParams);
 
         escodegenParams.format = {
-            compact: options.getOption('compact')
+            compact: options.get<boolean>('compact')
         };
 
         return escodegen.generate(astTree, escodegenParams);

+ 0 - 14
src/Kernel.ts

@@ -1,14 +0,0 @@
-import { IKernel } from "inversify";
-import { IObfuscator } from "./interfaces/IObfuscator";
-import { IOptions } from "./interfaces/IOptions";
-
-import { Kernel } from "inversify";
-import { Obfuscator } from "./Obfuscator";
-import { Options } from "./Options";
-
-let kernel: IKernel = new Kernel();
-
-kernel.bind<IOptions>('IOptions').to(Options).inSingletonScope();
-kernel.bind<IObfuscator>('IObfuscator').to(Obfuscator);
-
-export default kernel;

+ 5 - 10
src/Obfuscator.ts

@@ -1,5 +1,3 @@
-import { inject, injectable } from "inversify";
-
 import * as estraverse from 'estraverse';
 
 import { ICustomNode } from './interfaces/ICustomNode';
@@ -27,7 +25,6 @@ import { SelfDefendingNodesGroup } from "./node-groups/SelfDefendingNodesGroup";
 import { UnicodeArrayNodesGroup } from './node-groups/UnicodeArrayNodesGroup';
 import { VariableDeclarationObfuscator } from './node-obfuscators/VariableDeclarationObfuscator';
 
-@injectable()
 export class Obfuscator implements IObfuscator {
     /**
      * @type {Map<string, Node>}
@@ -61,9 +58,7 @@ export class Obfuscator implements IObfuscator {
     /**
      * @param options
      */
-    constructor (
-        @inject('IOptions') options: IOptions
-    ) {
+    constructor (options: IOptions) {
         this.options = options;
     }
 
@@ -151,22 +146,22 @@ export class Obfuscator implements IObfuscator {
     }
 
     private setNewNodes (): void {
-        if (this.options.getOption('selfDefending')) {
+        if (this.options.get('selfDefending')) {
             this.setNodesGroup(new SelfDefendingNodesGroup(this.options));
         }
 
-        if (this.options.getOption('disableConsoleOutput')) {
+        if (this.options.get('disableConsoleOutput')) {
             this.setNode(
                 'consoleOutputDisableExpressionNode',
                 new ConsoleOutputDisableExpressionNode(this.options)
             );
         }
 
-        if (this.options.getOption('debugProtection')) {
+        if (this.options.get('debugProtection')) {
             this.setNodesGroup(new DebugProtectionNodesGroup(this.options));
         }
 
-        if (this.options.getOption('unicodeArray')) {
+        if (this.options.get('unicodeArray')) {
             /**
              * Important to set this nodes latest to prevent runtime errors caused by `rotateUnicodeArray` option
              */

+ 13 - 21
src/Options.ts

@@ -1,11 +1,8 @@
-import { injectable } from "inversify";
-
 import { IOptions } from "./interfaces/IOptions";
 import { IOptionsPreset } from "./interfaces/IOptionsPreset";
 
 import { DEFAULT_PRESET } from "./preset-options/DefaultPreset";
 
-@injectable()
 export class Options implements IOptions {
     /**
      * @type {IOptionsPreset}
@@ -34,39 +31,34 @@ export class Options implements IOptions {
     /**
      * @param options
      */
-    public assign (options: IOptionsPreset): void {
-        if (this.options) {
-            throw new Error('Options object can\'t be reassigned!');
-        }
-
-        this.options = Object.assign({}, DEFAULT_PRESET, options);
-
-        this.normalizeOptions();
+    constructor (options: IOptionsPreset) {
+        this.options = Object.freeze(
+            Options.normalizeOptions(
+                Object.assign({}, DEFAULT_PRESET, options)
+            )
+        );
     }
 
     /**
      * @param optionName
-     * @returns {any}
+     * @returns {T}
      */
-    public getOption (optionName: string): any {
-        return this.options[optionName];
+    public get <T> (optionName: string): T {
+        return <T> this.options[optionName];
     }
 
     /**
+     * @param options
      * @returns {IOptionsPreset}
      */
-    public getOptions (): IOptionsPreset {
-        return this.options;
-    }
-
-    private normalizeOptions (): void {
-        let normalizedOptions: IOptionsPreset = Object.assign({}, this.options);
+    public static normalizeOptions (options: IOptionsPreset): IOptionsPreset {
+        let normalizedOptions: IOptionsPreset = Object.assign({}, options);
 
         normalizedOptions = Options.unicodeArrayRule(normalizedOptions);
         normalizedOptions = Options.unicodeArrayThresholdRule(normalizedOptions);
         normalizedOptions = Options.selfDefendingRule(normalizedOptions);
 
-        this.options = Object.freeze(normalizedOptions);
+        return normalizedOptions;
     }
 
     /**

+ 1 - 1
src/custom-nodes/unicode-array-nodes/UnicodeArrayDecodeNode.ts

@@ -81,7 +81,7 @@ export class UnicodeArrayDecodeNode extends Node {
         let code: string = '',
             node: INode;
 
-        if (this.options.getOption('selfDefending')) {
+        if (this.options.get('selfDefending')) {
             code = `
                 var ${environmentName} = function(){return ${Utils.stringToUnicode('dev')};};
                    

+ 1 - 1
src/custom-nodes/unicode-array-nodes/UnicodeArrayRotateFunctionNode.ts

@@ -86,7 +86,7 @@ export class UnicodeArrayRotateFunctionNode extends Node {
             whileFunctionName: string = Utils.getRandomVariableName(),
             node: INode;
 
-        if (this.options.getOption('selfDefending')) {
+        if (this.options.get('selfDefending')) {
             code = JavaScriptObfuscator.obfuscate(`
                 (function () {
                     var func = function(){return ${Utils.stringToUnicode('dev')};};

+ 1 - 8
src/interfaces/IOptions.d.ts

@@ -1,15 +1,8 @@
 import { IOptionsPreset } from "./IOptionsPreset";
 
 export interface IOptions {
-    /**
-     * @param options
-     */
-    assign (options: IOptionsPreset): void;
-
     /**
      * @param optionName
      */
-    getOption (optionName: string): any;
-
-    getOptions (): IOptionsPreset;
+    get <T> (optionName: string): T;
 }

+ 1 - 0
src/interfaces/IOptionsPreset.d.ts

@@ -10,4 +10,5 @@ export interface IOptionsPreset {
     unicodeArray?: boolean;
     unicodeArrayThreshold?: number;
     wrapUnicodeArrayCalls?: boolean;
+    [key: string]: any;
 }

+ 1 - 1
src/node-groups/DebugProtectionNodesGroup.ts

@@ -28,7 +28,7 @@ export class DebugProtectionNodesGroup extends NodesGroup {
             new DebugProtectionFunctionCallNode(this.debugProtectionFunctionIdentifier, this.options)
         );
 
-        if (this.options.getOption('debugProtectionInterval')) {
+        if (this.options.get('debugProtectionInterval')) {
             this.nodes.set(
                 'debugProtectionFunctionIntervalNode',
                 new DebugProtectionFunctionIntervalNode(this.debugProtectionFunctionIdentifier, this.options)

+ 4 - 4
src/node-groups/UnicodeArrayNodesGroup.ts

@@ -29,7 +29,7 @@ export class UnicodeArrayNodesGroup extends NodesGroup {
     constructor (options: IOptions) {
         super(options);
 
-        this.unicodeArrayRotateValue = this.options.getOption('rotateUnicodeArray') ? Utils.getRandomInteger(100, 500) : 0;
+        this.unicodeArrayRotateValue = this.options.get('rotateUnicodeArray') ? Utils.getRandomInteger(100, 500) : 0;
 
         let unicodeArrayNode: UnicodeArrayNode = new UnicodeArrayNode(
                 this.unicodeArrayName,
@@ -43,7 +43,7 @@ export class UnicodeArrayNodesGroup extends NodesGroup {
             unicodeArrayNode
         );
 
-        if (this.options.getOption('wrapUnicodeArrayCalls')) {
+        if (this.options.get('wrapUnicodeArrayCalls')) {
             this.nodes.set(
                 'unicodeArrayCallsWrapper',
                 new UnicodeArrayCallsWrapper(
@@ -55,7 +55,7 @@ export class UnicodeArrayNodesGroup extends NodesGroup {
             );
         }
 
-        if (this.options.getOption('encodeUnicodeLiterals')) {
+        if (this.options.get('encodeUnicodeLiterals')) {
             this.nodes.set(
                 'unicodeArrayDecodeNode',
                 new UnicodeArrayDecodeNode (
@@ -66,7 +66,7 @@ export class UnicodeArrayNodesGroup extends NodesGroup {
             );
         }
 
-        if (this.options.getOption('rotateUnicodeArray')) {
+        if (this.options.get('rotateUnicodeArray')) {
             this.nodes.set(
                 'unicodeArrayRotateFunctionNode',
                 new UnicodeArrayRotateFunctionNode(

+ 6 - 6
src/node-obfuscators/NodeObfuscator.ts

@@ -6,8 +6,8 @@ import { IOptions } from "../interfaces/IOptions";
 import { JSFuck } from "../enums/JSFuck";
 
 import { NodeUtils } from "../NodeUtils";
+import { UnicodeArrayNode } from "../custom-nodes/unicode-array-nodes/UnicodeArrayNode";
 import { Utils } from '../Utils';
-import {UnicodeArrayNode} from "../custom-nodes/unicode-array-nodes/UnicodeArrayNode";
 
 export abstract class NodeObfuscator implements INodeObfuscator {
     /**
@@ -40,7 +40,7 @@ export abstract class NodeObfuscator implements INodeObfuscator {
      * @returns {boolean}
      */
     protected isReservedName (name: string): boolean {
-        return this.options.getOption('reservedNames')
+        return this.options.get<string[]>('reservedNames')
             .some((reservedName: string) => {
                 return new RegExp(reservedName, 'g').test(name);
             });
@@ -99,15 +99,15 @@ export abstract class NodeObfuscator implements INodeObfuscator {
      */
     protected replaceLiteralValueByUnicodeValue (nodeValue: string): string {
         let value: string = nodeValue,
-            replaceByUnicodeArrayFlag: boolean = Math.random() <= this.options.getOption('unicodeArrayThreshold');
+            replaceByUnicodeArrayFlag: boolean = Math.random() <= this.options.get('unicodeArrayThreshold');
 
-        if (this.options.getOption('encodeUnicodeLiterals') && replaceByUnicodeArrayFlag) {
+        if (this.options.get('encodeUnicodeLiterals') && replaceByUnicodeArrayFlag) {
             value = Utils.btoa(value);
         }
 
         value = Utils.stringToUnicode(value);
 
-        if (!this.options.getOption('unicodeArray') || !replaceByUnicodeArrayFlag) {
+        if (!this.options.get('unicodeArray') || !replaceByUnicodeArrayFlag) {
             return value;
         }
 
@@ -134,7 +134,7 @@ export abstract class NodeObfuscator implements INodeObfuscator {
 
         hexadecimalIndex = this.replaceLiteralNumberByHexadecimalValue(index);
 
-        if (this.options.getOption('wrapUnicodeArrayCalls')) {
+        if (this.options.get('wrapUnicodeArrayCalls')) {
             return `${this.nodes.get('unicodeArrayCallsWrapper').getNodeIdentifier()}('${hexadecimalIndex}')`;
         }
 

+ 1 - 1
tsconfig.json

@@ -6,7 +6,7 @@
     "emitDecoratorMetadata": true,
     "experimentalDecorators": true,
     "removeComments": true,
-    "noImplicitAny": false
+    "noImplicitAny": true
   },
   "exclude": [
     "node_modules",

+ 1 - 2
typings.json

@@ -6,7 +6,6 @@
     "estree": "github:DefinitelyTyped/DefinitelyTyped/estree/estree.d.ts",
     "esprima": "github:DefinitelyTyped/DefinitelyTyped/esprima/esprima.d.ts",
     "escodegen": "github:DefinitelyTyped/DefinitelyTyped/escodegen/escodegen.d.ts",
-    "estraverse": "github:DefinitelyTyped/DefinitelyTyped/estraverse/estraverse.d.ts",
-    "inversify": "npm:inversify-dts/inversify/inversify.d.ts"
+    "estraverse": "github:DefinitelyTyped/DefinitelyTyped/estraverse/estraverse.d.ts"
   }
 }

+ 0 - 1
typings/browser.d.ts

@@ -2,5 +2,4 @@
 /// <reference path="browser/ambient/esprima/index.d.ts" />
 /// <reference path="browser/ambient/estraverse/index.d.ts" />
 /// <reference path="browser/ambient/estree/index.d.ts" />
-/// <reference path="browser/ambient/inversify/index.d.ts" />
 /// <reference path="browser/ambient/node/index.d.ts" />

+ 0 - 211
typings/browser/ambient/inversify/index.d.ts

@@ -1,211 +0,0 @@
-// Generated by typings
-// Source: node_modules/inversify-dts/inversify/inversify.d.ts
-// Type definitions for inversify 2.0.0-beta.8
-// Project: https://github.com/inversify/InversifyJS
-// Definitions by: inversify <https://github.com/inversify>
-// Definitions: https://github.com/borisyankov/DefinitelyTyped
-
-interface Symbol {
-    toString(): string;
-    valueOf(): Object;
-}
-
-interface SymbolConstructor {
-    (description?: string|number): Symbol;
-}
-
-declare var Symbol: SymbolConstructor;
-
-declare namespace inversify {
-
-    export interface IKernelConstructor {
-        new(): IKernel;
-    }
-
-    export interface PlanAndResolve<T> {
-        (args: PlanAndResolveArgs): T[];
-    }
-
-    export interface IMiddleware extends Function {
-        (next: PlanAndResolve<any>): PlanAndResolve<any>;
-    }
-
-    export interface PlanAndResolveArgs {
-        multiInject: boolean;
-        serviceIdentifier: (string|Symbol|INewable<any>);
-        target: ITarget;
-        contextInterceptor: (contexts: IContext) => IContext;
-    }
-
-    export interface IKernel {
-        bind<T>(serviceIdentifier: (string|Symbol|INewable<T>)): IBindingToSyntax<T>;
-        unbind(serviceIdentifier: (string|Symbol|any)): void;
-        unbindAll(): void;
-        get<T>(serviceIdentifier: (string|Symbol|INewable<T>)): T;
-        getNamed<T>(serviceIdentifier: (string|Symbol|INewable<T>), named: string): T;
-        getTagged<T>(serviceIdentifier: (string|Symbol|INewable<T>), key: string, value: any): T;
-        getAll<T>(serviceIdentifier: (string|Symbol|INewable<T>)): T[];
-        load(...modules: IKernelModule[]): void;
-        applyMiddleware(...middleware: IMiddleware[]): void;
-        getServiceIdentifierAsString(serviceIdentifier: (string|Symbol|INewable<any>)): string;
-        snapshot(): void;
-        restore(): void;
-    }
-
-    export interface IKernelModule extends Function {
-        (kernel: IKernel): void;
-    }
-
-    interface IBindingOnSyntax<T> {
-        onActivation(fn: (context: IContext, injectable: T) => T): IBindingWhenSyntax<T>;
-    }
-
-    interface IBindingInSyntax<T> {
-        inSingletonScope(): IBindingWhenOnSyntax<T>;
-    }
-
-    interface IBindingWhenSyntax<T> {
-        when(constraint: (request: IRequest) => boolean): IBindingOnSyntax<T>;
-        whenTargetNamed(name: string): IBindingOnSyntax<T>;
-        whenTargetTagged(tag: string, value: any): IBindingOnSyntax<T>;
-        whenInjectedInto(parent: (Function|string)): IBindingOnSyntax<T>;
-        whenParentNamed(name: string): IBindingOnSyntax<T>;
-        whenParentTagged(tag: string, value: any): IBindingOnSyntax<T>;
-        whenAnyAncestorIs(ancestor: (Function|string)): IBindingOnSyntax<T>;
-        whenNoAncestorIs(ancestor: (Function|string)): IBindingOnSyntax<T>;
-        whenAnyAncestorNamed(name: string): IBindingOnSyntax<T>;
-        whenAnyAncestorTagged(tag: string, value: any): IBindingOnSyntax<T>;
-        whenNoAncestorNamed(name: string): IBindingOnSyntax<T>;
-        whenNoAncestorTagged(tag: string, value: any): IBindingOnSyntax<T>;
-        whenAnyAncestorMatches(constraint: (request: IRequest) => boolean): IBindingOnSyntax<T>;
-        whenNoAncestorMatches(constraint: (request: IRequest) => boolean): IBindingOnSyntax<T>;
-    }
-
-    interface IBindingToSyntax<T> {
-        to(constructor: { new(...args: any[]): T; }): IBindingInWhenOnSyntax<T>;
-        toConstantValue(value: T): IBindingWhenOnSyntax<T>;
-        toDynamicValue(func: () => T): IBindingWhenOnSyntax<T>;
-        toConstructor<T2>(constructor: INewable<T2>): IBindingWhenOnSyntax<T>;
-        toFactory<T2>(factory: IFactoryCreator<T2>): IBindingWhenOnSyntax<T>;
-        toAutoFactory<T2>(serviceIdentifier: (string|Symbol|T2)): IBindingWhenOnSyntax<T>;
-        toProvider<T2>(provider: IProviderCreator<T2>): IBindingWhenOnSyntax<T>;
-    }
-
-    interface IBindingInWhenOnSyntax<T> extends IBindingInSyntax<T>, IBindingWhenOnSyntax<T> {}
-    interface IBindingWhenOnSyntax<T> extends IBindingWhenSyntax<T>, IBindingOnSyntax<T> {}
-
-    export interface IFactory<T> extends Function {
-        (...args: any[]): (((...args: any[]) => T)|T);
-    }
-
-    interface IFactoryCreator<T> extends Function {
-        (context: IContext): IFactory<T>;
-    }
-
-    export interface INewable<T> {
-        new(...args: any[]): T;
-    }
-
-    export interface IProvider<T> extends Function {
-        (): Promise<T>;
-    }
-
-    interface IProviderCreator<T> extends Function {
-        (context: IContext): IProvider<T>;
-    }
-
-    export interface IContext {
-        kernel: IKernel;
-        plan: IPlan;
-        addPlan(plan: IPlan): void;
-    }
-
-    export interface IPlan {
-        parentContext: IContext;
-        rootRequest: IRequest;
-    }
-
-    export interface IRequest {
-        serviceIdentifier: (string|Symbol|INewable<any>);
-        parentContext: IContext;
-        parentRequest: IRequest;
-        childRequests: IRequest[];
-        target: ITarget;
-        bindings: IBinding<any>[];
-        addChildRequest(
-            serviceIdentifier: (string|Symbol|INewable<any>),
-            bindings: (IBinding<any>|IBinding<any>[]),
-            target: ITarget): IRequest;
-    }
-
-    export interface IBinding<T> {
-        activated: boolean;
-        serviceIdentifier: (string|Symbol|INewable<T>);
-        implementationType: INewable<T>;
-        factory: IFactoryCreator<any>;
-        provider: IProviderCreator<any>;
-        constraint: (request: IRequest) => boolean;
-        onActivation: (context: IContext, injectable: T) => T;
-        cache: T;
-        dynamicValue: () => T;
-        scope: number; // BindingScope
-        type: number; // BindingType
-    }
-
-    export interface ITarget {
-        serviceIdentifier: (string|Symbol|INewable<any>);
-        name: IQueryableString;
-        metadata: Array<IMetadata>;
-        hasTag(key: string): boolean;
-        isArray(): boolean;
-        matchesArray(name: string|Symbol|any): boolean;
-        isNamed(): boolean;
-        isTagged(): boolean;
-        matchesNamedTag(name: string): boolean;
-        matchesTag(key: string): (value: any) => boolean;
-    }
-
-    export interface IQueryableString {
-        startsWith(searchString: string): boolean;
-        endsWith(searchString: string): boolean;
-        contains(searchString: string): boolean;
-        equals(compareString: string): boolean;
-        value(): string;
-    }
-
-    export interface IMetadata {
-        key: string;
-        value: any;
-    }
-
-    export var Kernel: IKernelConstructor;
-    export var decorate: (decorator: (ClassDecorator|ParameterDecorator), target: any, parameterIndex?: number) => void;
-    export function injectable(): (typeConstructor: any) => void;
-    export function tagged(metadataKey: string, metadataValue: any): (target: any, targetKey: string, index?: number) => any;
-    export function named(name: string): (target: any, targetKey: string, index?: number) => any;
-    export function targetName(name: string): (target: any, targetKey: string, index: number) => any;
-    export function inject(serviceIdentifier: (string|Symbol|any)): (target: any, targetKey: string, index?: number) => any;
-    export function multiInject(serviceIdentifier: (string|Symbol|any)): (target: any, targetKey: string, index?: number) => any;
-
-    export function makePropertyInjectDecorator(kernel: IKernel):
-        (serviceIdentifier: (string|Symbol|INewable<any>)) => (proto: any, key: string) => void;
-
-    export function makePropertyInjectNamedDecorator(kernel: IKernel):
-        (serviceIdentifier: (string|Symbol|INewable<any>), named: string) => (proto: any, key: string) => void;
-
-    export function makePropertyInjectTaggedDecorator(kernel: IKernel):
-        (serviceIdentifier: (string|Symbol|INewable<any>), key: string, value: any) => (proto: any, propertyName: string) => void;
-
-    export function makePropertyMultiInjectDecorator(kernel: IKernel):
-        (serviceIdentifier: (string|Symbol|INewable<any>)) => (proto: any, key: string) => void;
-
-    // constraint helpers
-    export var traverseAncerstors: (request: IRequest, constraint: (request: IRequest) => boolean) => boolean;
-    export var taggedConstraint: (tag: string) => (value: any) => (request: IRequest) => boolean;
-    export var namedConstraint: (value: any) => (request: IRequest) => boolean;
-    export var typeConstraint: (type: (Function|string)) => (request: IRequest) => boolean;
-}
-
-declare module "inversify" {
-  export = inversify;
-}

+ 0 - 1
typings/main.d.ts

@@ -2,5 +2,4 @@
 /// <reference path="main/ambient/esprima/index.d.ts" />
 /// <reference path="main/ambient/estraverse/index.d.ts" />
 /// <reference path="main/ambient/estree/index.d.ts" />
-/// <reference path="main/ambient/inversify/index.d.ts" />
 /// <reference path="main/ambient/node/index.d.ts" />

+ 0 - 211
typings/main/ambient/inversify/index.d.ts

@@ -1,211 +0,0 @@
-// Generated by typings
-// Source: node_modules/inversify-dts/inversify/inversify.d.ts
-// Type definitions for inversify 2.0.0-beta.8
-// Project: https://github.com/inversify/InversifyJS
-// Definitions by: inversify <https://github.com/inversify>
-// Definitions: https://github.com/borisyankov/DefinitelyTyped
-
-interface Symbol {
-    toString(): string;
-    valueOf(): Object;
-}
-
-interface SymbolConstructor {
-    (description?: string|number): Symbol;
-}
-
-declare var Symbol: SymbolConstructor;
-
-declare namespace inversify {
-
-    export interface IKernelConstructor {
-        new(): IKernel;
-    }
-
-    export interface PlanAndResolve<T> {
-        (args: PlanAndResolveArgs): T[];
-    }
-
-    export interface IMiddleware extends Function {
-        (next: PlanAndResolve<any>): PlanAndResolve<any>;
-    }
-
-    export interface PlanAndResolveArgs {
-        multiInject: boolean;
-        serviceIdentifier: (string|Symbol|INewable<any>);
-        target: ITarget;
-        contextInterceptor: (contexts: IContext) => IContext;
-    }
-
-    export interface IKernel {
-        bind<T>(serviceIdentifier: (string|Symbol|INewable<T>)): IBindingToSyntax<T>;
-        unbind(serviceIdentifier: (string|Symbol|any)): void;
-        unbindAll(): void;
-        get<T>(serviceIdentifier: (string|Symbol|INewable<T>)): T;
-        getNamed<T>(serviceIdentifier: (string|Symbol|INewable<T>), named: string): T;
-        getTagged<T>(serviceIdentifier: (string|Symbol|INewable<T>), key: string, value: any): T;
-        getAll<T>(serviceIdentifier: (string|Symbol|INewable<T>)): T[];
-        load(...modules: IKernelModule[]): void;
-        applyMiddleware(...middleware: IMiddleware[]): void;
-        getServiceIdentifierAsString(serviceIdentifier: (string|Symbol|INewable<any>)): string;
-        snapshot(): void;
-        restore(): void;
-    }
-
-    export interface IKernelModule extends Function {
-        (kernel: IKernel): void;
-    }
-
-    interface IBindingOnSyntax<T> {
-        onActivation(fn: (context: IContext, injectable: T) => T): IBindingWhenSyntax<T>;
-    }
-
-    interface IBindingInSyntax<T> {
-        inSingletonScope(): IBindingWhenOnSyntax<T>;
-    }
-
-    interface IBindingWhenSyntax<T> {
-        when(constraint: (request: IRequest) => boolean): IBindingOnSyntax<T>;
-        whenTargetNamed(name: string): IBindingOnSyntax<T>;
-        whenTargetTagged(tag: string, value: any): IBindingOnSyntax<T>;
-        whenInjectedInto(parent: (Function|string)): IBindingOnSyntax<T>;
-        whenParentNamed(name: string): IBindingOnSyntax<T>;
-        whenParentTagged(tag: string, value: any): IBindingOnSyntax<T>;
-        whenAnyAncestorIs(ancestor: (Function|string)): IBindingOnSyntax<T>;
-        whenNoAncestorIs(ancestor: (Function|string)): IBindingOnSyntax<T>;
-        whenAnyAncestorNamed(name: string): IBindingOnSyntax<T>;
-        whenAnyAncestorTagged(tag: string, value: any): IBindingOnSyntax<T>;
-        whenNoAncestorNamed(name: string): IBindingOnSyntax<T>;
-        whenNoAncestorTagged(tag: string, value: any): IBindingOnSyntax<T>;
-        whenAnyAncestorMatches(constraint: (request: IRequest) => boolean): IBindingOnSyntax<T>;
-        whenNoAncestorMatches(constraint: (request: IRequest) => boolean): IBindingOnSyntax<T>;
-    }
-
-    interface IBindingToSyntax<T> {
-        to(constructor: { new(...args: any[]): T; }): IBindingInWhenOnSyntax<T>;
-        toConstantValue(value: T): IBindingWhenOnSyntax<T>;
-        toDynamicValue(func: () => T): IBindingWhenOnSyntax<T>;
-        toConstructor<T2>(constructor: INewable<T2>): IBindingWhenOnSyntax<T>;
-        toFactory<T2>(factory: IFactoryCreator<T2>): IBindingWhenOnSyntax<T>;
-        toAutoFactory<T2>(serviceIdentifier: (string|Symbol|T2)): IBindingWhenOnSyntax<T>;
-        toProvider<T2>(provider: IProviderCreator<T2>): IBindingWhenOnSyntax<T>;
-    }
-
-    interface IBindingInWhenOnSyntax<T> extends IBindingInSyntax<T>, IBindingWhenOnSyntax<T> {}
-    interface IBindingWhenOnSyntax<T> extends IBindingWhenSyntax<T>, IBindingOnSyntax<T> {}
-
-    export interface IFactory<T> extends Function {
-        (...args: any[]): (((...args: any[]) => T)|T);
-    }
-
-    interface IFactoryCreator<T> extends Function {
-        (context: IContext): IFactory<T>;
-    }
-
-    export interface INewable<T> {
-        new(...args: any[]): T;
-    }
-
-    export interface IProvider<T> extends Function {
-        (): Promise<T>;
-    }
-
-    interface IProviderCreator<T> extends Function {
-        (context: IContext): IProvider<T>;
-    }
-
-    export interface IContext {
-        kernel: IKernel;
-        plan: IPlan;
-        addPlan(plan: IPlan): void;
-    }
-
-    export interface IPlan {
-        parentContext: IContext;
-        rootRequest: IRequest;
-    }
-
-    export interface IRequest {
-        serviceIdentifier: (string|Symbol|INewable<any>);
-        parentContext: IContext;
-        parentRequest: IRequest;
-        childRequests: IRequest[];
-        target: ITarget;
-        bindings: IBinding<any>[];
-        addChildRequest(
-            serviceIdentifier: (string|Symbol|INewable<any>),
-            bindings: (IBinding<any>|IBinding<any>[]),
-            target: ITarget): IRequest;
-    }
-
-    export interface IBinding<T> {
-        activated: boolean;
-        serviceIdentifier: (string|Symbol|INewable<T>);
-        implementationType: INewable<T>;
-        factory: IFactoryCreator<any>;
-        provider: IProviderCreator<any>;
-        constraint: (request: IRequest) => boolean;
-        onActivation: (context: IContext, injectable: T) => T;
-        cache: T;
-        dynamicValue: () => T;
-        scope: number; // BindingScope
-        type: number; // BindingType
-    }
-
-    export interface ITarget {
-        serviceIdentifier: (string|Symbol|INewable<any>);
-        name: IQueryableString;
-        metadata: Array<IMetadata>;
-        hasTag(key: string): boolean;
-        isArray(): boolean;
-        matchesArray(name: string|Symbol|any): boolean;
-        isNamed(): boolean;
-        isTagged(): boolean;
-        matchesNamedTag(name: string): boolean;
-        matchesTag(key: string): (value: any) => boolean;
-    }
-
-    export interface IQueryableString {
-        startsWith(searchString: string): boolean;
-        endsWith(searchString: string): boolean;
-        contains(searchString: string): boolean;
-        equals(compareString: string): boolean;
-        value(): string;
-    }
-
-    export interface IMetadata {
-        key: string;
-        value: any;
-    }
-
-    export var Kernel: IKernelConstructor;
-    export var decorate: (decorator: (ClassDecorator|ParameterDecorator), target: any, parameterIndex?: number) => void;
-    export function injectable(): (typeConstructor: any) => void;
-    export function tagged(metadataKey: string, metadataValue: any): (target: any, targetKey: string, index?: number) => any;
-    export function named(name: string): (target: any, targetKey: string, index?: number) => any;
-    export function targetName(name: string): (target: any, targetKey: string, index: number) => any;
-    export function inject(serviceIdentifier: (string|Symbol|any)): (target: any, targetKey: string, index?: number) => any;
-    export function multiInject(serviceIdentifier: (string|Symbol|any)): (target: any, targetKey: string, index?: number) => any;
-
-    export function makePropertyInjectDecorator(kernel: IKernel):
-        (serviceIdentifier: (string|Symbol|INewable<any>)) => (proto: any, key: string) => void;
-
-    export function makePropertyInjectNamedDecorator(kernel: IKernel):
-        (serviceIdentifier: (string|Symbol|INewable<any>), named: string) => (proto: any, key: string) => void;
-
-    export function makePropertyInjectTaggedDecorator(kernel: IKernel):
-        (serviceIdentifier: (string|Symbol|INewable<any>), key: string, value: any) => (proto: any, propertyName: string) => void;
-
-    export function makePropertyMultiInjectDecorator(kernel: IKernel):
-        (serviceIdentifier: (string|Symbol|INewable<any>)) => (proto: any, key: string) => void;
-
-    // constraint helpers
-    export var traverseAncerstors: (request: IRequest, constraint: (request: IRequest) => boolean) => boolean;
-    export var taggedConstraint: (tag: string) => (value: any) => (request: IRequest) => boolean;
-    export var namedConstraint: (value: any) => (request: IRequest) => boolean;
-    export var typeConstraint: (type: (Function|string)) => (request: IRequest) => boolean;
-}
-
-declare module "inversify" {
-  export = inversify;
-}